<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.dhcc.finance.main.dao.CwHsGlorgbookMapper"> <resultMap id="BaseResultMap" type="com.dhcc.finance.main.domain.CwHsGlorgbook"> <id column="ID" jdbcType="VARCHAR" property="id" /> <result column="GLORGBOOK_CODE" jdbcType="VARCHAR" property="glorgbookCode" /> <result column="GLORGBOOK_NAME" jdbcType="VARCHAR" property="glorgbookName" /> <result column="COMPANY_FLAG" jdbcType="VARCHAR" property="companyFlag" /> <result column="START_DATE" jdbcType="VARCHAR" property="startDate" /> <result column="END_DATE" jdbcType="VARCHAR" property="endDate" /> <result column="PRODUCT_ID" jdbcType="VARCHAR" property="productId" /> <result column="SUB_PRODUCT_ID" jdbcType="VARCHAR" property="subProductId" /> <result column="DF_COMPANY" jdbcType="VARCHAR" property="dfCompany" /> <result column="MAP_FLAG" jdbcType="VARCHAR" property="mapFlag" /> <result column="IMPORT_MODE" jdbcType="VARCHAR" property="importMode" /> <result column="LAST_DATE" jdbcType="VARCHAR" property="lastDate" /> <result column="INPUT_MAN" jdbcType="VARCHAR" property="inputMan" /> <result column="INPUT_TIME" jdbcType="TIMESTAMP" property="inputTime" /> <result column="USE_STATE" jdbcType="VARCHAR" property="useState" /> <result column="CREATE_USER" jdbcType="VARCHAR" property="createUser" /> <result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime" /> <result column="UPDATE_USER" jdbcType="VARCHAR" property="updateUser" /> <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" /> <result column="REMARK" jdbcType="VARCHAR" property="remark" /> </resultMap> <resultMap id="BaseResultMap2" type="com.dhcc.finance.main.domain.CwHsSubcodemap"> <id column="ID" jdbcType="VARCHAR" property="id" /> <result column="BOOK_CODE" jdbcType="INTEGER" property="bookCode" /> <result column="COMPANY_FLAG" jdbcType="VARCHAR" property="companyFlag" /> <result column="IMPORT_FLAG" jdbcType="VARCHAR" property="importFlag" /> <result column="SUB_CODE" jdbcType="VARCHAR" property="subCode" /> <result column="SUB_NAME" jdbcType="VARCHAR" property="subName" /> <result column="SEID_ID" jdbcType="VARCHAR" property="seidId" /> <result column="STOCK_TYPE" jdbcType="VARCHAR" property="stockType" /> <result column="SUB_CODE_V" jdbcType="VARCHAR" property="subCodeV" /> <result column="SUB_NAME_V" jdbcType="VARCHAR" property="subNameV" /> <result column="PRODUCT_ID" jdbcType="VARCHAR" property="productId" /> <result column="SUB_PRODUCT_ID" jdbcType="VARCHAR" property="subProductId" /> <result column="USE_STATE" jdbcType="VARCHAR" property="useState" /> <result column="CREATE_USER" jdbcType="VARCHAR" property="createUser" /> <result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime" /> <result column="UPDATE_USER" jdbcType="VARCHAR" property="updateUser" /> <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" /> <result column="REMARK" jdbcType="VARCHAR" property="remark" /> </resultMap> <sql id="Example_Where_Clause"> <where> <foreach collection="oredCriteria" item="criteria" separator="or"> <if test="criteria.valid"> <trim prefix="(" prefixOverrides="and" suffix=")"> <foreach collection="criteria.criteria" item="criterion"> <choose> <when test="criterion.noValue"> and ${criterion.condition} </when> <when test="criterion.singleValue"> and ${criterion.condition} #{criterion.value} </when> <when test="criterion.betweenValue"> and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} </when> <when test="criterion.listValue"> and ${criterion.condition} <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> #{listItem} </foreach> </when> </choose> </foreach> </trim> </if> </foreach> </where> </sql> <sql id="Update_By_Example_Where_Clause"> <where> <foreach collection="example.oredCriteria" item="criteria" separator="or"> <if test="criteria.valid"> <trim prefix="(" prefixOverrides="and" suffix=")"> <foreach collection="criteria.criteria" item="criterion"> <choose> <when test="criterion.noValue"> and ${criterion.condition} </when> <when test="criterion.singleValue"> and ${criterion.condition} #{criterion.value} </when> <when test="criterion.betweenValue"> and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} </when> <when test="criterion.listValue"> and ${criterion.condition} <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> #{listItem} </foreach> </when> </choose> </foreach> </trim> </if> </foreach> </where> </sql> <sql id="Base_Column_List"> ID, GLORGBOOK_CODE, GLORGBOOK_NAME, COMPANY_FLAG, START_DATE, END_DATE, PRODUCT_ID, SUB_PRODUCT_ID, DF_COMPANY, MAP_FLAG, IMPORT_MODE, LAST_DATE, INPUT_MAN, INPUT_TIME, USE_STATE, CREATE_USER, CREATE_TIME, UPDATE_USER, UPDATE_TIME, REMARK </sql> <select id="selectByExample" parameterType="com.dhcc.finance.main.domain.CwHsGlorgbookExample" resultMap="BaseResultMap"> select <if test="distinct"> distinct </if> <include refid="Base_Column_List" /> from cw_hs_glorgbook <if test="_parameter != null"> <include refid="Example_Where_Clause" /> </if> <if test="orderByClause != null"> order by ${orderByClause} </if> </select> <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> select <include refid="Base_Column_List" /> from cw_hs_glorgbook where ID = #{id,jdbcType=VARCHAR} </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.String"> delete from cw_hs_glorgbook where ID = #{id,jdbcType=VARCHAR} </delete> <delete id="deleteByExample" parameterType="com.dhcc.finance.main.domain.CwHsGlorgbookExample"> delete from cw_hs_glorgbook <if test="_parameter != null"> <include refid="Example_Where_Clause" /> </if> </delete> <insert id="insert" parameterType="com.dhcc.finance.main.domain.CwHsGlorgbook"> insert into cw_hs_glorgbook (ID, GLORGBOOK_CODE, GLORGBOOK_NAME, COMPANY_FLAG, START_DATE, END_DATE, PRODUCT_ID, SUB_PRODUCT_ID, DF_COMPANY, MAP_FLAG, IMPORT_MODE, LAST_DATE, INPUT_MAN, INPUT_TIME, USE_STATE, CREATE_USER, CREATE_TIME, UPDATE_USER, UPDATE_TIME, REMARK) values (#{id,jdbcType=VARCHAR}, #{glorgbookCode,jdbcType=VARCHAR}, #{glorgbookName,jdbcType=VARCHAR}, #{companyFlag,jdbcType=VARCHAR}, #{startDate,jdbcType=VARCHAR}, #{endDate,jdbcType=VARCHAR}, #{productId,jdbcType=VARCHAR}, #{subProductId,jdbcType=VARCHAR}, #{dfCompany,jdbcType=VARCHAR}, #{mapFlag,jdbcType=VARCHAR}, #{importMode,jdbcType=VARCHAR}, #{lastDate,jdbcType=VARCHAR}, #{inputMan,jdbcType=VARCHAR}, #{inputTime,jdbcType=TIMESTAMP}, #{useState,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}) </insert> <insert id="insertSelective" parameterType="com.dhcc.finance.main.domain.CwHsGlorgbook"> insert into cw_hs_glorgbook <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null"> ID, </if> <if test="glorgbookCode != null"> GLORGBOOK_CODE, </if> <if test="glorgbookName != null"> GLORGBOOK_NAME, </if> <if test="companyFlag != null"> COMPANY_FLAG, </if> <if test="startDate != null"> START_DATE, </if> <if test="endDate != null"> END_DATE, </if> <if test="productId != null"> PRODUCT_ID, </if> <if test="subProductId != null"> SUB_PRODUCT_ID, </if> <if test="dfCompany != null"> DF_COMPANY, </if> <if test="mapFlag != null"> MAP_FLAG, </if> <if test="importMode != null"> IMPORT_MODE, </if> <if test="lastDate != null"> LAST_DATE, </if> <if test="inputMan != null"> INPUT_MAN, </if> <if test="inputTime != null"> INPUT_TIME, </if> <if test="useState != null"> USE_STATE, </if> <if test="createUser != null"> CREATE_USER, </if> <if test="createTime != null"> CREATE_TIME, </if> <if test="updateUser != null"> UPDATE_USER, </if> <if test="updateTime != null"> UPDATE_TIME, </if> <if test="remark != null"> REMARK, </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null"> #{id,jdbcType=VARCHAR}, </if> <if test="glorgbookCode != null"> #{glorgbookCode,jdbcType=VARCHAR}, </if> <if test="glorgbookName != null"> #{glorgbookName,jdbcType=VARCHAR}, </if> <if test="companyFlag != null"> #{companyFlag,jdbcType=VARCHAR}, </if> <if test="startDate != null"> #{startDate,jdbcType=VARCHAR}, </if> <if test="endDate != null"> #{endDate,jdbcType=VARCHAR}, </if> <if test="productId != null"> #{productId,jdbcType=VARCHAR}, </if> <if test="subProductId != null"> #{subProductId,jdbcType=VARCHAR}, </if> <if test="dfCompany != null"> #{dfCompany,jdbcType=VARCHAR}, </if> <if test="mapFlag != null"> #{mapFlag,jdbcType=VARCHAR}, </if> <if test="importMode != null"> #{importMode,jdbcType=VARCHAR}, </if> <if test="lastDate != null"> #{lastDate,jdbcType=VARCHAR}, </if> <if test="inputMan != null"> #{inputMan,jdbcType=VARCHAR}, </if> <if test="inputTime != null"> #{inputTime,jdbcType=TIMESTAMP}, </if> <if test="useState != null"> #{useState,jdbcType=VARCHAR}, </if> <if test="createUser != null"> #{createUser,jdbcType=VARCHAR}, </if> <if test="createTime != null"> #{createTime,jdbcType=TIMESTAMP}, </if> <if test="updateUser != null"> #{updateUser,jdbcType=VARCHAR}, </if> <if test="updateTime != null"> #{updateTime,jdbcType=TIMESTAMP}, </if> <if test="remark != null"> #{remark,jdbcType=VARCHAR}, </if> </trim> </insert> <select id="countByExample" parameterType="com.dhcc.finance.main.domain.CwHsGlorgbookExample" resultType="java.lang.Long"> select count(*) from cw_hs_glorgbook <if test="_parameter != null"> <include refid="Example_Where_Clause" /> </if> </select> <update id="updateByExampleSelective" parameterType="map"> update cw_hs_glorgbook <set> <if test="record.id != null"> ID = #{record.id,jdbcType=VARCHAR}, </if> <if test="record.glorgbookCode != null"> GLORGBOOK_CODE = #{record.glorgbookCode,jdbcType=VARCHAR}, </if> <if test="record.glorgbookName != null"> GLORGBOOK_NAME = #{record.glorgbookName,jdbcType=VARCHAR}, </if> <if test="record.companyFlag != null"> COMPANY_FLAG = #{record.companyFlag,jdbcType=VARCHAR}, </if> <if test="record.startDate != null"> START_DATE = #{record.startDate,jdbcType=VARCHAR}, </if> <if test="record.endDate != null"> END_DATE = #{record.endDate,jdbcType=VARCHAR}, </if> <if test="record.productId != null"> PRODUCT_ID = #{record.productId,jdbcType=VARCHAR}, </if> <if test="record.subProductId != null"> SUB_PRODUCT_ID = #{record.subProductId,jdbcType=VARCHAR}, </if> <if test="record.dfCompany != null"> DF_COMPANY = #{record.dfCompany,jdbcType=VARCHAR}, </if> <if test="record.mapFlag != null"> MAP_FLAG = #{record.mapFlag,jdbcType=VARCHAR}, </if> <if test="record.importMode != null"> IMPORT_MODE = #{record.importMode,jdbcType=VARCHAR}, </if> <if test="record.lastDate != null"> LAST_DATE = #{record.lastDate,jdbcType=VARCHAR}, </if> <if test="record.inputMan != null"> INPUT_MAN = #{record.inputMan,jdbcType=VARCHAR}, </if> <if test="record.inputTime != null"> INPUT_TIME = #{record.inputTime,jdbcType=TIMESTAMP}, </if> <if test="record.useState != null"> USE_STATE = #{record.useState,jdbcType=VARCHAR}, </if> <if test="record.createUser != null"> CREATE_USER = #{record.createUser,jdbcType=VARCHAR}, </if> <if test="record.createTime != null"> CREATE_TIME = #{record.createTime,jdbcType=TIMESTAMP}, </if> <if test="record.updateUser != null"> UPDATE_USER = #{record.updateUser,jdbcType=VARCHAR}, </if> <if test="record.updateTime != null"> UPDATE_TIME = #{record.updateTime,jdbcType=TIMESTAMP}, </if> <if test="record.remark != null"> REMARK = #{record.remark,jdbcType=VARCHAR}, </if> </set> <if test="_parameter != null"> <include refid="Update_By_Example_Where_Clause" /> </if> </update> <update id="updateByExample" parameterType="map"> update cw_hs_glorgbook set ID = #{record.id,jdbcType=VARCHAR}, GLORGBOOK_CODE = #{record.glorgbookCode,jdbcType=VARCHAR}, GLORGBOOK_NAME = #{record.glorgbookName,jdbcType=VARCHAR}, COMPANY_FLAG = #{record.companyFlag,jdbcType=VARCHAR}, START_DATE = #{record.startDate,jdbcType=VARCHAR}, END_DATE = #{record.endDate,jdbcType=VARCHAR}, PRODUCT_ID = #{record.productId,jdbcType=VARCHAR}, SUB_PRODUCT_ID = #{record.subProductId,jdbcType=VARCHAR}, DF_COMPANY = #{record.dfCompany,jdbcType=VARCHAR}, MAP_FLAG = #{record.mapFlag,jdbcType=VARCHAR}, IMPORT_MODE = #{record.importMode,jdbcType=VARCHAR}, LAST_DATE = #{record.lastDate,jdbcType=VARCHAR}, INPUT_MAN = #{record.inputMan,jdbcType=VARCHAR}, INPUT_TIME = #{record.inputTime,jdbcType=TIMESTAMP}, USE_STATE = #{record.useState,jdbcType=VARCHAR}, CREATE_USER = #{record.createUser,jdbcType=VARCHAR}, CREATE_TIME = #{record.createTime,jdbcType=TIMESTAMP}, UPDATE_USER = #{record.updateUser,jdbcType=VARCHAR}, UPDATE_TIME = #{record.updateTime,jdbcType=TIMESTAMP}, REMARK = #{record.remark,jdbcType=VARCHAR} <if test="_parameter != null"> <include refid="Update_By_Example_Where_Clause" /> </if> </update> <update id="updateByPrimaryKeySelective" parameterType="com.dhcc.finance.main.domain.CwHsGlorgbook"> update cw_hs_glorgbook <set> <if test="glorgbookCode != null"> GLORGBOOK_CODE = #{glorgbookCode,jdbcType=VARCHAR}, </if> <if test="glorgbookName != null"> GLORGBOOK_NAME = #{glorgbookName,jdbcType=VARCHAR}, </if> <if test="companyFlag != null"> COMPANY_FLAG = #{companyFlag,jdbcType=VARCHAR}, </if> <if test="startDate != null"> START_DATE = #{startDate,jdbcType=VARCHAR}, </if> <if test="endDate != null"> END_DATE = #{endDate,jdbcType=VARCHAR}, </if> <if test="productId != null"> PRODUCT_ID = #{productId,jdbcType=VARCHAR}, </if> <if test="subProductId != null"> SUB_PRODUCT_ID = #{subProductId,jdbcType=VARCHAR}, </if> <if test="dfCompany != null"> DF_COMPANY = #{dfCompany,jdbcType=VARCHAR}, </if> <if test="mapFlag != null"> MAP_FLAG = #{mapFlag,jdbcType=VARCHAR}, </if> <if test="importMode != null"> IMPORT_MODE = #{importMode,jdbcType=VARCHAR}, </if> <if test="lastDate != null"> LAST_DATE = #{lastDate,jdbcType=VARCHAR}, </if> <if test="inputMan != null"> INPUT_MAN = #{inputMan,jdbcType=VARCHAR}, </if> <if test="inputTime != null"> INPUT_TIME = #{inputTime,jdbcType=TIMESTAMP}, </if> <if test="useState != null"> USE_STATE = #{useState,jdbcType=VARCHAR}, </if> <if test="createUser != null"> CREATE_USER = #{createUser,jdbcType=VARCHAR}, </if> <if test="createTime != null"> CREATE_TIME = #{createTime,jdbcType=TIMESTAMP}, </if> <if test="updateUser != null"> UPDATE_USER = #{updateUser,jdbcType=VARCHAR}, </if> <if test="updateTime != null"> UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP}, </if> <if test="remark != null"> REMARK = #{remark,jdbcType=VARCHAR}, </if> </set> where ID = #{id,jdbcType=VARCHAR} </update> <update id="updateByPrimaryKey" parameterType="com.dhcc.finance.main.domain.CwHsGlorgbook"> update cw_hs_glorgbook set GLORGBOOK_CODE = #{glorgbookCode,jdbcType=VARCHAR}, GLORGBOOK_NAME = #{glorgbookName,jdbcType=VARCHAR}, COMPANY_FLAG = #{companyFlag,jdbcType=VARCHAR}, START_DATE = #{startDate,jdbcType=VARCHAR}, END_DATE = #{endDate,jdbcType=VARCHAR}, PRODUCT_ID = #{productId,jdbcType=VARCHAR}, SUB_PRODUCT_ID = #{subProductId,jdbcType=VARCHAR}, DF_COMPANY = #{dfCompany,jdbcType=VARCHAR}, MAP_FLAG = #{mapFlag,jdbcType=VARCHAR}, IMPORT_MODE = #{importMode,jdbcType=VARCHAR}, LAST_DATE = #{lastDate,jdbcType=VARCHAR}, INPUT_MAN = #{inputMan,jdbcType=VARCHAR}, INPUT_TIME = #{inputTime,jdbcType=TIMESTAMP}, USE_STATE = #{useState,jdbcType=VARCHAR}, CREATE_USER = #{createUser,jdbcType=VARCHAR}, CREATE_TIME = #{createTime,jdbcType=TIMESTAMP}, UPDATE_USER = #{updateUser,jdbcType=VARCHAR}, UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP}, REMARK = #{remark,jdbcType=VARCHAR} where ID = #{id,jdbcType=VARCHAR} </update> <select id="selectCwHsGlorgbookAllData" resultMap="BaseResultMap"> SELECT ID, GLORGBOOK_CODE, GLORGBOOK_NAME, COMPANY_FLAG, START_DATE, END_DATE, PRODUCT_ID, SUB_PRODUCT_ID, DF_COMPANY, MAP_FLAG, IMPORT_MODE, date_format(LAST_DATE, '%Y-%m-%d') AS LAST_DATE, INPUT_MAN, INPUT_TIME, USE_STATE, CREATE_USER, (SELECT max(PREPAREDATE) FROM cw_gl_voucher a where a.PK_GLORGBOOK=c.DF_COMPANY GROUP BY PK_GLORGBOOK) as CREATE_TIME, UPDATE_USER, UPDATE_TIME, REMARK FROM cw_hs_glorgbook c <where> <if test="glorgbookCode!=null"> c.GLORGBOOK_CODE =#{glorgbookCode,jdbcType=VARCHAR} </if> and c.USE_STATE ="1" </where> </select> <update id="deletCwHsGlorgbookinfo" parameterType="java.lang.String"> update CW_HS_GLORGBOOK set use_state="0" where ID in ( <foreach collection="IdList" open="" item="item" separator="," close=""> #{item,jdbcType=VARCHAR} </foreach> ) </update> <select id="selectCwHsGlorgbookAndCwHsSub" resultMap="BaseResultMap2"> SELECT * FROM CW_HS_SUBCODEMAP B WHERE B.PRODUCT_ID=#{productId,jdbcType=VARCHAR} AND USE_STATE='1' <if test="subCode != null"> and SUB_CODE = #{subCode,jdbcType=VARCHAR} </if> <if test="subCodeV != null"> and SUB_CODE_V = #{subCodeV,jdbcType=VARCHAR} </if> order by SUB_CODE_V </select> <insert id="insertForbatch" parameterType="java.lang.String"> insert into cw_hs_subcodemap(ID, BOOK_CODE, COMPANY_FLAG, IMPORT_FLAG, SUB_CODE, SUB_NAME, SEID_ID, STOCK_TYPE, SUB_CODE_V, SUB_NAME_V, PRODUCT_ID, SUB_PRODUCT_ID, USE_STATE, CREATE_USER, CREATE_TIME, UPDATE_USER, UPDATE_TIME, REMARK ) select MD5(uuid()) as ID, BOOK_CODE, COMPANY_FLAG, IMPORT_FLAG, SUB_CODE, SUB_NAME, SEID_ID, STOCK_TYPE, SUB_CODE_V, SUB_NAME_V,#{productId,jdbcType=VARCHAR}, SUB_PRODUCT_ID, USE_STATE, CREATE_USER, CREATE_TIME, UPDATE_USER, UPDATE_TIME, REMARK from cw_hs_subcodemap b where b.product_id='0' and use_state='1' </insert> <update id="updateMapFlog" parameterType="java.lang.String"> update cw_hs_glorgbook set MAP_FLAG='2' WHERE PRODUCT_ID=#{projectId,jdbcType=VARCHAR} </update> <select id="selectCwHsGlorgbookCount" parameterType="java.lang.String" resultType="int"> SELECT count(0) FROM CW_HS_SUBCODEMAP B WHERE B.PRODUCT_ID=#{productId,jdbcType=VARCHAR} AND USE_STATE='1' </select> <select id="selectGlorgbookSame" parameterType="java.lang.String" resultType="int"> </select> </mapper>