hd_real_name/target/classes/mappers/person/WhiteListMapper.xml

77 lines
3.1 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.bonus.gzrn.rnbmw.person.dao.WhiteListDao">
<insert id="toRedList">
INSERT INTO `bm_redlist_worker`(`company_id`, `sub_name`, `pro_name`, `name`, `id_number`, `phone`, `post`, `add_time`, `remark`)
VALUES (#{companyId}, #{subName}, #{proName}, #{name}, #{idNumber}, #{phone}, #{postName}, #{submissionDate}, #{remark});
</insert>
<insert id="toBlackList">
INSERT INTO `bm_blacklist_worker`(`company_id`, `name`, `id_number`, `post`, `remark`, `event`, `dept`, `person_type`, `status`)
VALUES (#{companyId}, #{name}, #{idNumber}, #{postName}, NULL, #{remark}, #{proName}, '1', '1');
</insert>
<delete id="toWhiteList">
delete from bm_redlist_worker where id_number = #{idNumber}
</delete>
<select id="getWhiteListCount" resultType="java.lang.Integer">
SELECT
COUNT(vww.ID_NUMBER)
FROM
v_white_worker vww
<where>
<if test="params != null and params !=''">
<if test="params.companyId != null and params.companyId !=''">
and vww.company_id = #{params.companyId}
</if>
<if test="params.proId != null and params.proId !=''">
and vww.pro_id = #{params.proId}
</if>
<if test="params.status != null and params.status !=''">
and vww.is_red_or_white = #{params.status}
</if>
<if test="params.keyWord != null and params.keyWord !=''">
and ( instr(vww.`NAME`,#{params.keyWord}) > 0
or instr(vww.`ID_NUMBER`,#{params.keyWord}) > 0 )
</if>
</if>
</where>
</select>
<select id="getWhiteList" resultType="com.bonus.gzrn.rnbmw.person.entity.WhiteListBean">
SELECT
vww.company_id as companyId,
vww.`NAME`,
vww.ID_NUMBER AS idNumber,
vww.post_name AS postName,
vww.team_name AS teamName,
vww.SUB_NAME AS subName,
vww.pro_name AS proName,
vww.is_red_or_white AS status
FROM
v_white_worker vww
<where>
<if test="params != null and params !=''">
<if test="params.orgId != null and params.orgId !=''">
and vww.company_id = #{params.orgId}
</if>
<if test="params.proId != null and params.proId !=''">
and vww.pro_id = #{params.proId}
</if>
<if test="params.status != null and params.status !=''">
and vww.is_red_or_white = #{params.status}
</if>
<if test="params.keyWord != null and params.keyWord !=''">
and ( instr(vww.`NAME`,#{params.keyWord}) > 0
or instr(vww.`ID_NUMBER`,#{params.keyWord}) > 0 )
</if>
</if>
</where>
LIMIT #{offset}, #{limit}
</select>
</mapper>