<?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.CwBdAccassMapper"> <resultMap id="BaseResultMap" type="com.dhcc.finance.main.domain.CwBdAccass"> <id column="PK_ACCASS" jdbcType="VARCHAR" property="pkAccass" /> <result column="PK_SUBJSCHEME" jdbcType="VARCHAR" property="pkSubjscheme" /> <result column="PK_ACCSUBJ" jdbcType="VARCHAR" property="pkAccsubj" /> <result column="ASSORDER" jdbcType="INTEGER" property="assorder" /> <result column="PK_ACCASSITEM" jdbcType="VARCHAR" property="pkAccassitem" /> <result column="ISMUST" jdbcType="VARCHAR" property="ismust" /> <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"> PK_ACCASS, PK_SUBJSCHEME, PK_ACCSUBJ, ASSORDER, PK_ACCASSITEM, ISMUST, USE_STATE, CREATE_USER, CREATE_TIME, UPDATE_USER, UPDATE_TIME, REMARK </sql> <select id="selectByExample" parameterType="com.dhcc.finance.main.domain.CwBdAccassExample" resultMap="BaseResultMap"> select <if test="distinct"> distinct </if> <include refid="Base_Column_List" /> from cw_bd_accass <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_bd_accass where PK_ACCASS = #{pkAccass,jdbcType=VARCHAR} </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.String"> delete from cw_bd_accass where PK_ACCASS = #{pkAccass,jdbcType=VARCHAR} </delete> <delete id="deleteByExample" parameterType="com.dhcc.finance.main.domain.CwBdAccassExample"> delete from cw_bd_accass <if test="_parameter != null"> <include refid="Example_Where_Clause" /> </if> </delete> <insert id="insert" parameterType="com.dhcc.finance.main.domain.CwBdAccass"> insert into cw_bd_accass (PK_ACCASS, PK_SUBJSCHEME, PK_ACCSUBJ, ASSORDER, PK_ACCASSITEM, ISMUST, USE_STATE, CREATE_USER, CREATE_TIME, UPDATE_USER, UPDATE_TIME, REMARK ) values (#{pkAccass,jdbcType=VARCHAR}, #{pkSubjscheme,jdbcType=VARCHAR}, #{pkAccsubj,jdbcType=VARCHAR}, #{assorder,jdbcType=INTEGER}, #{pkAccassitem,jdbcType=VARCHAR}, #{ismust,jdbcType=VARCHAR}, #{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.CwBdAccass"> insert into cw_bd_accass <trim prefix="(" suffix=")" suffixOverrides=","> <if test="pkAccass != null"> PK_ACCASS, </if> <if test="pkSubjscheme != null"> PK_SUBJSCHEME, </if> <if test="pkAccsubj != null"> PK_ACCSUBJ, </if> <if test="assorder != null"> ASSORDER, </if> <if test="pkAccassitem != null"> PK_ACCASSITEM, </if> <if test="ismust != null"> ISMUST, </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="pkAccass != null"> #{pkAccass,jdbcType=VARCHAR}, </if> <if test="pkSubjscheme != null"> #{pkSubjscheme,jdbcType=VARCHAR}, </if> <if test="pkAccsubj != null"> #{pkAccsubj,jdbcType=VARCHAR}, </if> <if test="assorder != null"> #{assorder,jdbcType=INTEGER}, </if> <if test="pkAccassitem != null"> #{pkAccassitem,jdbcType=VARCHAR}, </if> <if test="ismust != null"> #{ismust,jdbcType=VARCHAR}, </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.CwBdAccassExample" resultType="java.lang.Long"> select count(*) from cw_bd_accass <if test="_parameter != null"> <include refid="Example_Where_Clause" /> </if> </select> <update id="updateByExampleSelective" parameterType="map"> update cw_bd_accass <set> <if test="record.pkAccass != null"> PK_ACCASS = #{record.pkAccass,jdbcType=VARCHAR}, </if> <if test="record.pkSubjscheme != null"> PK_SUBJSCHEME = #{record.pkSubjscheme,jdbcType=VARCHAR}, </if> <if test="record.pkAccsubj != null"> PK_ACCSUBJ = #{record.pkAccsubj,jdbcType=VARCHAR}, </if> <if test="record.assorder != null"> ASSORDER = #{record.assorder,jdbcType=INTEGER}, </if> <if test="record.pkAccassitem != null"> PK_ACCASSITEM = #{record.pkAccassitem,jdbcType=VARCHAR}, </if> <if test="record.ismust != null"> ISMUST = #{record.ismust,jdbcType=VARCHAR}, </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_bd_accass set PK_ACCASS = #{record.pkAccass,jdbcType=VARCHAR}, PK_SUBJSCHEME = #{record.pkSubjscheme,jdbcType=VARCHAR}, PK_ACCSUBJ = #{record.pkAccsubj,jdbcType=VARCHAR}, ASSORDER = #{record.assorder,jdbcType=INTEGER}, PK_ACCASSITEM = #{record.pkAccassitem,jdbcType=VARCHAR}, ISMUST = #{record.ismust,jdbcType=VARCHAR}, 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.CwBdAccass"> update cw_bd_accass <set> <if test="pkSubjscheme != null"> PK_SUBJSCHEME = #{pkSubjscheme,jdbcType=VARCHAR}, </if> <if test="pkAccsubj != null"> PK_ACCSUBJ = #{pkAccsubj,jdbcType=VARCHAR}, </if> <if test="assorder != null"> ASSORDER = #{assorder,jdbcType=INTEGER}, </if> <if test="pkAccassitem != null"> PK_ACCASSITEM = #{pkAccassitem,jdbcType=VARCHAR}, </if> <if test="ismust != null"> ISMUST = #{ismust,jdbcType=VARCHAR}, </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 PK_ACCASS = #{pkAccass,jdbcType=VARCHAR} </update> <update id="updateByPrimaryKey" parameterType="com.dhcc.finance.main.domain.CwBdAccass"> update cw_bd_accass set PK_SUBJSCHEME = #{pkSubjscheme,jdbcType=VARCHAR}, PK_ACCSUBJ = #{pkAccsubj,jdbcType=VARCHAR}, ASSORDER = #{assorder,jdbcType=INTEGER}, PK_ACCASSITEM = #{pkAccassitem,jdbcType=VARCHAR}, ISMUST = #{ismust,jdbcType=VARCHAR}, 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 PK_ACCASS = #{pkAccass,jdbcType=VARCHAR} </update> <!-- 逻辑删除某会计科目下的所有辅助信息 --> <update id="updateBypPkAccsubj" parameterType="java.util.Map"> update cw_bd_accass set USE_STATE = '0', UPDATE_USER = #{updateUser,jdbcType=VARCHAR}, UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP} where PK_ACCSUBJ in <foreach collection="list" item="item" index="index" open="(" close=")" separator=","> #{item} </foreach> </update> <!-- dml逻辑删除某版本下的会计科目下的全部辅助配置--> <update id="updateByPkSubjscheme" parameterType="com.dhcc.finance.main.domain.CwBdSubjscheme"> update cw_bd_accass a set USE_STATE = '0', UPDATE_USER = #{updateUser,jdbcType=VARCHAR}, UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP} where exists(select 1 from cw_bd_accsubj b where b.PK_SUBJSCHEME=#{pkSubjscheme,jdbcType=VARCHAR} and a.PK_ACCSUBJ=b.PK_ACCSUBJ ) </update> <!--dml会计科目辅助项复制 --> <insert id="insertCpCwBdAccass" parameterType="com.dhcc.finance.main.model.CwBdSubjschemeAdd"> insert into cw_bd_accass (PK_ACCASS, PK_SUBJSCHEME, PK_ACCSUBJ, ASSORDER, PK_ACCASSITEM, ISMUST, USE_STATE, CREATE_USER, CREATE_TIME, UPDATE_USER, UPDATE_TIME, REMARK) select MD5(uuid()) as PK_ACCASS, #{pkSubjscheme,jdbcType=VARCHAR} as PK_SUBJSCHEME, ( select PK_ACCSUBJ from cw_bd_accsubj where SUBJCODE =( select SUBJCODE from cw_bd_accsubj b where a.PK_ACCSUBJ=b.PK_ACCSUBJ ) and PK_SUBJSCHEME=#{pkSubjscheme,jdbcType=VARCHAR} and USE_STATE='1' ) as PK_ACCSUBJ, ASSORDER, PK_ACCASSITEM, ISMUST, USE_STATE, #{updateUser,jdbcType=VARCHAR} as CREATE_USER , #{updateTime,jdbcType=TIMESTAMP} as CREATE_TIME, UPDATE_USER, UPDATE_TIME, REMARK from cw_bd_accass a where PK_SUBJSCHEME=#{choosesubject,jdbcType=VARCHAR} and USE_STATE='1' </insert> <!--批量新增数据 --> <insert id="insertCwBdAccassBatch" parameterType="java.util.List"> insert into cw_bd_accass (PK_ACCASS, PK_SUBJSCHEME, PK_ACCSUBJ, ASSORDER, PK_ACCASSITEM, ISMUST, USE_STATE, CREATE_USER, CREATE_TIME, UPDATE_USER, UPDATE_TIME, REMARK ) values <foreach collection="list" item="item" index="index" separator="," > ( #{item.pkAccass,jdbcType=VARCHAR}, #{item.pkSubjscheme,jdbcType=VARCHAR}, #{item.pkAccsubj,jdbcType=VARCHAR}, #{item.assorder,jdbcType=INTEGER}, #{item.pkAccassitem,jdbcType=VARCHAR}, #{item.ismust,jdbcType=VARCHAR}, #{item.useState,jdbcType=VARCHAR}, #{item.createUser,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP}, #{item.updateUser,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP}, #{item.remark,jdbcType=VARCHAR} ) </foreach> </insert> <!-- 查询此辅助项下的凭证数量--> <select id="selectIsExistsFreeForVoucher" parameterType="java.lang.String" resultType="java.lang.Long"> select count(*) from cw_bd_accass as a where a.PK_ACCSUBJ in (select PK_ACCSUBJ from cw_bd_accsubj as b where b.SUBJCODE in (select SUBJCODE from cw_gl_detail c where c.PK_VOUCHER in (select PK_VOUCHER from cw_gl_voucher g where g.USE_STATE='1') and c.USE_STATE='1') and b.USE_STATE='1') and PK_ACCASS=#{pkAccass,jdbcType=VARCHAR} and a.USE_STATE='1' </select> </mapper>