150 lines
5.2 KiB
XML
150 lines
5.2 KiB
XML
|
<?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.zhwl.base.mapper.ZdyBaseEmployeeCardMapper">
|
||
|
|
||
|
<resultMap type="ZdyBaseEmployeeCard" id="ZdyBaseEmployeeCardResult">
|
||
|
<result property="id" column="id"/>
|
||
|
<result property="cardNo" column="card_no"/>
|
||
|
<result property="cardStatus" column="card_status"/>
|
||
|
<result property="createTime" column="create_time"/>
|
||
|
<result property="createBy" column="create_by"/>
|
||
|
<result property="updateTime" column="update_time"/>
|
||
|
<result property="updateBy" column="update_by"/>
|
||
|
<result property="remark" column="remark"/>
|
||
|
<result property="employeeName" column="employeeName"/>
|
||
|
<result property="deptId" column="dept_id"/>
|
||
|
</resultMap>
|
||
|
|
||
|
<sql id="selectZdyBaseEmployeeCardVo">
|
||
|
SELECT
|
||
|
bec.id,
|
||
|
bec.card_no,
|
||
|
bec.card_status,
|
||
|
bec.create_time,
|
||
|
bec.create_by,
|
||
|
bec.update_time,
|
||
|
bec.update_by,
|
||
|
bec.remark,
|
||
|
be.NAME AS employeeName,
|
||
|
bec.dept_id
|
||
|
FROM
|
||
|
zdy_base_employee_card bec
|
||
|
LEFT JOIN zdy_base_employee be ON bec.card_no = be.card_no
|
||
|
</sql>
|
||
|
|
||
|
<select id="selectZdyBaseEmployeeCardList" parameterType="ZdyBaseEmployeeCard"
|
||
|
resultMap="ZdyBaseEmployeeCardResult">
|
||
|
<include refid="selectZdyBaseEmployeeCardVo"/>
|
||
|
left join sys_dept d on d.dept_id = bec.dept_id
|
||
|
<where>
|
||
|
<if test="cardNo != null and cardNo != ''">
|
||
|
and bec.card_no = #{cardNo}
|
||
|
</if>
|
||
|
<if test="cardStatus != null ">
|
||
|
and bec.card_status = #{cardStatus}
|
||
|
</if>
|
||
|
${params.dataScope}
|
||
|
</where>
|
||
|
</select>
|
||
|
|
||
|
<select id="selectZdyBaseEmployeeCardById" parameterType="Long"
|
||
|
resultMap="ZdyBaseEmployeeCardResult">
|
||
|
<include refid="selectZdyBaseEmployeeCardVo"/>
|
||
|
where bec.id = #{id}
|
||
|
</select>
|
||
|
|
||
|
<insert id="insertZdyBaseEmployeeCard" parameterType="ZdyBaseEmployeeCard" useGeneratedKeys="true"
|
||
|
keyProperty="id">
|
||
|
insert into zdy_base_employee_card
|
||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
<if test="cardNo != null">card_no,
|
||
|
</if>
|
||
|
<if test="cardStatus != null">card_status,
|
||
|
</if>
|
||
|
<if test="createTime != null">create_time,
|
||
|
</if>
|
||
|
<if test="createBy != null">create_by,
|
||
|
</if>
|
||
|
<if test="updateTime != null">update_time,
|
||
|
</if>
|
||
|
<if test="updateBy != null">update_by,
|
||
|
</if>
|
||
|
<if test="remark != null">remark,
|
||
|
</if>
|
||
|
<if test="deptId != null">dept_id,
|
||
|
</if>
|
||
|
</trim>
|
||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
<if test="cardNo != null">#{cardNo},
|
||
|
</if>
|
||
|
<if test="cardStatus != null">#{cardStatus},
|
||
|
</if>
|
||
|
<if test="createTime != null">#{createTime},
|
||
|
</if>
|
||
|
<if test="createBy != null">#{createBy},
|
||
|
</if>
|
||
|
<if test="updateTime != null">#{updateTime},
|
||
|
</if>
|
||
|
<if test="updateBy != null">#{updateBy},
|
||
|
</if>
|
||
|
<if test="remark != null">#{remark},
|
||
|
</if>
|
||
|
<if test="deptId != null">#{deptId},
|
||
|
</if>
|
||
|
</trim>
|
||
|
</insert>
|
||
|
|
||
|
<update id="updateZdyBaseEmployeeCard" parameterType="ZdyBaseEmployeeCard">
|
||
|
update zdy_base_employee_card
|
||
|
<trim prefix="SET" suffixOverrides=",">
|
||
|
<if test="cardNo != null">card_no =
|
||
|
#{cardNo},
|
||
|
</if>
|
||
|
<if test="cardStatus != null">card_status =
|
||
|
#{cardStatus},
|
||
|
</if>
|
||
|
<if test="createTime != null">create_time =
|
||
|
#{createTime},
|
||
|
</if>
|
||
|
<if test="createBy != null">create_by =
|
||
|
#{createBy},
|
||
|
</if>
|
||
|
<if test="updateTime != null">update_time =
|
||
|
#{updateTime},
|
||
|
</if>
|
||
|
<if test="updateBy != null">update_by =
|
||
|
#{updateBy},
|
||
|
</if>
|
||
|
<if test="remark != null">remark =
|
||
|
#{remark},
|
||
|
</if>
|
||
|
<if test="deptId != null">dept_id =
|
||
|
#{deptId},
|
||
|
</if>
|
||
|
</trim>
|
||
|
where id = #{id}
|
||
|
</update>
|
||
|
|
||
|
<delete id="deleteZdyBaseEmployeeCardById" parameterType="Long">
|
||
|
delete
|
||
|
from zdy_base_employee_card
|
||
|
where id = #{id}
|
||
|
</delete>
|
||
|
|
||
|
<delete id="deleteZdyBaseEmployeeCardByIds" parameterType="String">
|
||
|
delete from zdy_base_employee_card where id in
|
||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||
|
#{id}
|
||
|
</foreach>
|
||
|
</delete>
|
||
|
<select id="selectZdyBaseEmployeeCardByCardNo" parameterType="String"
|
||
|
resultMap="ZdyBaseEmployeeCardResult">
|
||
|
<include refid="selectZdyBaseEmployeeCardVo"/>
|
||
|
where bec.card_no = #{cardNo} limit 1
|
||
|
</select>
|
||
|
|
||
|
|
||
|
</mapper>
|