123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439 |
- <?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.liang.dao.BasePersonDao">
- <resultMap type="com.liang.entity.BasePerson" id="BasePersonMap">
- <result property="id" column="ID" jdbcType="INTEGER"/>
- <result property="dw" column="DW" jdbcType="INTEGER"/>
- <result property="dwmc" column="DWMC" jdbcType="VARCHAR"/>
- <result property="xm" column="XM" jdbcType="VARCHAR"/>
- <result property="xb" column="XB" jdbcType="VARCHAR"/>
- <result property="mz" column="MZ" jdbcType="VARCHAR"/>
- <result property="csd" column="CSD" jdbcType="VARCHAR"/>
- <result property="csrq" column="CSRQ" jdbcType="TIMESTAMP"/>
- <result property="dp" column="DP" jdbcType="VARCHAR"/>
- <result property="hghq" column="HGHQ" jdbcType="VARCHAR"/>
- <result property="gzdw" column="GZDW" jdbcType="INTEGER"/>
- <result property="gddh" column="GDDH" jdbcType="VARCHAR"/>
- <result property="jtzz1" column="JTZZ1" jdbcType="VARCHAR"/>
- <result property="zzdh" column="ZZDH" jdbcType="VARCHAR"/>
- <result property="txdz1" column="TXDZ1" jdbcType="VARCHAR"/>
- <result property="dzyj" column="DZYJ" jdbcType="VARCHAR"/>
- <result property="byxx" column="BYXX" jdbcType="INTEGER"/>
- <result property="xl" column="XL" jdbcType="INTEGER"/>
- <result property="xw" column="XW" jdbcType="VARCHAR"/>
- <result property="zc" column="ZC" jdbcType="VARCHAR"/>
- <result property="zyzc" column="ZYZC" jdbcType="VARCHAR"/>
- <result property="bysj" column="BYSJ" jdbcType="TIMESTAMP"/>
- <result property="wyyz" column="WYYZ" jdbcType="INTEGER"/>
- <result property="slcd" column="SLCD" jdbcType="VARCHAR"/>
- <result property="csdz" column="CSDZ" jdbcType="VARCHAR"/>
- <result property="jtzz2" column="JTZZ2" jdbcType="VARCHAR"/>
- <result property="yzbm" column="YZBM" jdbcType="VARCHAR"/>
- <result property="txdz2" column="TXDZ2" jdbcType="VARCHAR"/>
- <result property="gjkjbxkly" column="GJKJBXKLY" jdbcType="VARCHAR"/>
- <result property="gjjjwxkly" column="GJJJWXKLY" jdbcType="VARCHAR"/>
- <result property="sygb" column="SYGB" jdbcType="VARCHAR"/>
- <result property="synf" column="SYNF" jdbcType="INTEGER"/>
- <result property="ys" column="YS" jdbcType="VARCHAR"/>
- <result property="bsh" column="BSH" jdbcType="VARCHAR"/>
- <result property="yddh" column="YDDH" jdbcType="VARCHAR"/>
- <result property="cz" column="CZ" jdbcType="VARCHAR"/>
- <result property="chjljrychqk" column="CHJLJRYCHQK" jdbcType="VARCHAR"/>
- <result property="xtyh" column="XTYH" jdbcType="INTEGER"/>
- <result property="bm" column="BM" jdbcType="INTEGER"/>
- <result property="bmmc" column="BMMC" jdbcType="VARCHAR"/>
- <result property="cjr" column="CJR" jdbcType="INTEGER"/>
- </resultMap>
- <!--查询单个-->
- <select id="queryById" resultMap="BasePersonMap">
- SELECT p.* , c.MC AS DWMC, d.MC AS DPMC, e.MC AS XLMC, g.MC AS XWMC, l.MC AS WYYZMC, a1.MC as HGHQMC, a2.MC as SYGBMC
- ,a1.MC as HGHQMC, a2.MC as SYGBMC, b.dept_name as BMMC, s.name AS BYXXMC, t.name AS ZCMC, m.name AS GJKJBXKLYMC, f.name AS GJJJWXKLY
- FROM
- base_Person AS p
- LEFT JOIN base_Company AS c ON p.DW = c.ID
- LEFT JOIN base_Party AS d ON p.DP = d.BM
- LEFT JOIN base_Education AS e ON p.XL = e.ID
- LEFT JOIN base_Degree AS g ON p.XW = g.BM
- LEFT JOIN base_Language AS l ON p.WYYZ = l.ID
- LEFT JOIN base_Area AS a1 ON p.HGHQ = a1.BM
- LEFT JOIN base_Area AS a2 ON p.SYGB = a2.BM
- LEFT JOIN sys_dept_info AS b ON p.BM = b.dept_id
- LEFT JOIN base_School AS s ON p.BYXX = s.id
- LEFT JOIN base_Title AS t ON p.ZC = t.id
- LEFT JOIN base_MOST AS m ON p.GJKJBXKLY = m.id
- LEFT JOIN base_Foundation AS f ON p.GJJJWXKLY = f.id
- where p.ID = #{id}
- </select>
- <!--查询指定行数据-->
- <select id="queryAllByLimit" resultMap="BasePersonMap">
- select
- ID, DW, XM, XB, MZ, CSD, CSRQ, DP, HGHQ, GZDW, GDDH, JTZZ1, ZZDH, TXDZ1, DZYJ, BYXX, XL, XW, ZC, ZYZC, BYSJ, WYYZ, SLCD, CSDZ, JTZZ2, YZBM, TXDZ2, GJKJBXKLY, GJJJWXKLY, SYGB, SYNF, YS, BSH, YDDH, CZ, CHJLJRYCHQK, XTYH, BM, CJR
- from base_Person
- <where>
- <if test="id != null">
- and ID = #{id}
- </if>
- <if test="dw != null">
- and DW = #{dw}
- </if>
- <if test="xm != null">
- and XM = #{xm}
- </if>
- <if test="xb != null and xb != ''">
- and XB = #{xb}
- </if>
- <if test="mz != null and mz != ''">
- and MZ = #{mz}
- </if>
- <if test="csd != null">
- and CSD = #{csd}
- </if>
- <if test="csrq != null">
- and CSRQ = #{csrq}
- </if>
- <if test="dp != null and dp != ''">
- and DP = #{dp}
- </if>
- <if test="hghq != null and hghq != ''">
- and HGHQ = #{hghq}
- </if>
- <if test="gzdw != null">
- and GZDW = #{gzdw}
- </if>
- <if test="gddh != null and gddh != ''">
- and GDDH = #{gddh}
- </if>
- <if test="jtzz1 != null">
- and JTZZ1 = #{jtzz1}
- </if>
- <if test="zzdh != null and zzdh != ''">
- and ZZDH = #{zzdh}
- </if>
- <if test="txdz1 != null">
- and TXDZ1 = #{txdz1}
- </if>
- <if test="dzyj != null and dzyj != ''">
- and DZYJ = #{dzyj}
- </if>
- <if test="byxx != null">
- and BYXX = #{byxx}
- </if>
- <if test="xl != null">
- and XL = #{xl}
- </if>
- <if test="xw != null and xw != ''">
- and XW = #{xw}
- </if>
- <if test="zc != null and zc != ''">
- and ZC = #{zc}
- </if>
- <if test="zyzc != null and zyzc != ''">
- and ZYZC = #{zyzc}
- </if>
- <if test="bysj != null">
- and BYSJ = #{bysj}
- </if>
- <if test="wyyz != null">
- and WYYZ = #{wyyz}
- </if>
- <if test="slcd != null and slcd != ''">
- and SLCD = #{slcd}
- </if>
- <if test="csdz != null and csdz != ''">
- and CSDZ = #{csdz}
- </if>
- <if test="jtzz2 != null and jtzz2 != ''">
- and JTZZ2 = #{jtzz2}
- </if>
- <if test="yzbm != null and yzbm != ''">
- and YZBM = #{yzbm}
- </if>
- <if test="txdz2 != null and txdz2 != ''">
- and TXDZ2 = #{txdz2}
- </if>
- <if test="gjkjbxkly != null and gjkjbxkly != ''">
- and GJKJBXKLY = #{gjkjbxkly}
- </if>
- <if test="gjjjwxkly != null and gjjjwxkly != ''">
- and GJJJWXKLY = #{gjjjwxkly}
- </if>
- <if test="sygb != null and sygb != ''">
- and SYGB = #{sygb}
- </if>
- <if test="synf != null">
- and SYNF = #{synf}
- </if>
- <if test="ys != null and ys != ''">
- and YS = #{ys}
- </if>
- <if test="bsh != null and bsh != ''">
- and BSH = #{bsh}
- </if>
- <if test="yddh != null and yddh != ''">
- and YDDH = #{yddh}
- </if>
- <if test="cz != null and cz != ''">
- and CZ = #{cz}
- </if>
- <if test="chjljrychqk != null">
- and CHJLJRYCHQK = #{chjljrychqk}
- </if>
- <if test="xtyh != null">
- and XTYH = #{xtyh}
- </if>
- <if test="bm != null">
- and BM = #{bm}
- </if>
- <if test="cjr != null">
- and CJR = #{cjr}
- </if>
- </where>
- limit #{pageable.offset}, #{pageable.pageSize}
- </select>
- <!--新增所有列-->
- <insert id="insert" keyProperty="id" useGeneratedKeys="true">
- if not exists (select * from base_Person where XM = #{xm} and DW = #{dw} and CSRQ = #{csrq})
- insert into base_Person(
- <if test="xb != null and xb != ''">XB,</if>
- <if test="mz != null and mz != ''">MZ,</if>
- <if test="csd != null and csd != ''">CSD,</if>
- <if test="dp != null and dp != ''">DP,</if>
- <if test="hghq != null and hghq != ''">HGHQ,</if>
- <if test="gzdw != null">GZDW,</if>
- <if test="gddh != null and gddh != ''">GDDH,</if>
- <if test="jtzz1 != null and jtzz1 != ''">JTZZ1,</if>
- <if test="zzdh != null and zzdh != ''">ZZDH,</if>
- <if test="txdz1 != null and txdz1 != ''">TXDZ1,</if>
- <if test="dzyj != null and dzyj != ''">DZYJ,</if>
- <if test="byxx != null">BYXX,</if>
- <if test="xw != null and xw != ''">XW,</if>
- <if test="bysj != null">BYSJ,</if>
- <if test="wyyz != null">WYYZ,</if>
- <if test="slcd != null and slcd != ''">SLCD,</if>
- <if test="csdz != null and csdz != ''">CSDZ,</if>
- <if test="jtzz2 != null and jtzz2 != ''">JTZZ2,</if>
- <if test="yzbm != null and yzbm != ''">YZBM,</if>
- <if test="txdz2 != null and txdz2 != ''">TXDZ2,</if>
- <if test="gjkjbxkly != null and gjkjbxkly != ''">GJKJBXKLY,</if>
- <if test="gjjjwxkly != null and gjjjwxkly != ''">GJJJWXKLY,</if>
- <if test="sygb != null and sygb != ''">SYGB,</if>
- <if test="synf != null">SYNF,</if>
- <if test="ys != null and ys != ''">YS,</if>
- <if test="bsh != null and bsh != ''">BSH,</if>
- <if test="yddh != null and yddh != ''">YDDH,</if>
- <if test="cz != null and cz != ''">CZ,</if>
- <if test="chjljrychqk != null and chjljrychqk != ''">CHJLJRYCHQK,</if>
- <if test="xtyh != null">XTYH,</if>
- <if test="bm != null">BM,</if>
- DW, XM,
- <if test="csrq != null">CSRQ,</if>
- ZC, ZYZC, XL, CJR)
- values (
- <if test="xb != null and xb != ''">#{xb},</if>
- <if test="mz != null and mz != ''">#{mz},</if>
- <if test="csd != null and csd != ''">#{csd},</if>
- <if test="dp != null and dp != ''">#{dp},</if>
- <if test="hghq != null and hghq != ''">#{hghq},</if>
- <if test="gzdw != null">#{gzdw},</if>
- <if test="gddh != null and gddh != ''">#{gddh},</if>
- <if test="jtzz1 != null and jtzz1 != ''">#{jtzz1},</if>
- <if test="zzdh != null and zzdh != ''">#{zzdh},</if>
- <if test="txdz1 != null and txdz1 != ''">#{txdz1},</if>
- <if test="dzyj != null and dzyj != ''">#{dzyj},</if>
- <if test="byxx != null">#{byxx},</if>
- <if test="xw != null and xw != ''">#{xw},</if>
- <if test="bysj != null">#{bysj},</if>
- <if test="wyyz != null">#{wyyz},</if>
- <if test="slcd != null and slcd != ''">#{slcd},</if>
- <if test="csdz != null and csdz != ''">#{csdz},</if>
- <if test="jtzz2 != null and jtzz2 != ''">#{jtzz2},</if>
- <if test="yzbm != null and yzbm != ''">#{yzbm},</if>
- <if test="txdz2 != null and txdz2 != ''">#{txdz2},</if>
- <if test="gjkjbxkly != null and gjkjbxkly != ''">#{gjkjbxkly},</if>
- <if test="gjjjwxkly != null and gjjjwxkly != ''">#{gjjjwxkly},</if>
- <if test="sygb != null and sygb != ''">#{sygb},</if>
- <if test="synf != null">#{synf},</if>
- <if test="ys != null and ys != ''">#{ys},</if>
- <if test="bsh != null and bsh != ''">#{bsh},</if>
- <if test="yddh != null and yddh != ''">#{yddh},</if>
- <if test="cz != null and cz != ''">#{cz},</if>
- <if test="chjljrychqk != null and chjljrychqk != ''">#{chjljrychqk},</if>
- <if test="xtyh != null">#{xtyh},</if>
- <if test="bm != null">#{bm},</if>
- #{dw}, #{xm},
- <if test="csrq != null">#{csrq},</if>
- #{zc}, #{zyzc}, #{xl}, #{cjr})
- </insert>
- <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
- insert into base_Person(DW, XM, XB, MZ, CSD, CSRQ, DP, HGHQ, GZDW, GDDH, JTZZ1, ZZDH, TXDZ1, DZYJ, BYXX, XL, XW, ZC, ZYZC, BYSJ, WYYZ, SLCD, CSDZ, JTZZ2, YZBM, TXDZ2, GJKJBXKLY, GJJJWXKLY, SYGB, SYNF, YS, BSH, YDDH, CZ, CHJLJRYCHQK, XTYH, BM, CJR)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.dw}, #{entity.xm}, #{entity.xb}, #{entity.mz}, #{entity.csd}, #{entity.csrq}, #{entity.dp}, #{entity.hghq}, #{entity.gzdw}, #{entity.gddh}, #{entity.jtzz1}, #{entity.zzdh}, #{entity.txdz1}, #{entity.dzyj}, #{entity.byxx}, #{entity.xl}, #{entity.xw}, #{entity.zc}, #{entity.zyzc}, #{entity.bysj}, #{entity.wyyz}, #{entity.slcd}, #{entity.csdz}, #{entity.jtzz2}, #{entity.yzbm}, #{entity.txdz2}, #{entity.gjkjbxkly}, #{entity.gjjjwxkly}, #{entity.sygb}, #{entity.synf}, #{entity.ys}, #{entity.bsh}, #{entity.yddh}, #{entity.cz}, #{entity.chjljrychqk}, #{entity.xtyh}, #{entity.bm}, #{entity.cjr})
- </foreach>
- </insert>
- <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
- insert into base_Person(DW, XM, XB, MZ, CSD, CSRQ, DP, HGHQ, GZDW, GDDH, JTZZ1, ZZDH, TXDZ1, DZYJ, BYXX, XL, XW, ZC, ZYZC, BYSJ, WYYZ, SLCD, CSDZ, JTZZ2, YZBM, TXDZ2, GJKJBXKLY, GJJJWXKLY, SYGB, SYNF, YS, BSH, YDDH, CZ, CHJLJRYCHQK, XTYH, BM, CJR)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.dw}, #{entity.xm}, #{entity.xb}, #{entity.mz}, #{entity.csd}, #{entity.csrq}, #{entity.dp}, #{entity.hghq}, #{entity.gzdw}, #{entity.gddh}, #{entity.jtzz1}, #{entity.zzdh}, #{entity.txdz1}, #{entity.dzyj}, #{entity.byxx}, #{entity.xl}, #{entity.xw}, #{entity.zc}, #{entity.zyzc}, #{entity.bysj}, #{entity.wyyz}, #{entity.slcd}, #{entity.csdz}, #{entity.jtzz2}, #{entity.yzbm}, #{entity.txdz2}, #{entity.gjkjbxkly}, #{entity.gjjjwxkly}, #{entity.sygb}, #{entity.synf}, #{entity.ys}, #{entity.bsh}, #{entity.yddh}, #{entity.cz}, #{entity.chjljrychqk}, #{entity.xtyh}, #{entity.bm}, #{entity.cjr})
- </foreach>
- on duplicate key update
- DW = values(DW),
- XM = values(XM),
- XB = values(XB),
- MZ = values(MZ),
- CSD = values(CSD),
- CSRQ = values(CSRQ),
- DP = values(DP),
- HGHQ = values(HGHQ),
- GZDW = values(GZDW),
- GDDH = values(GDDH),
- JTZZ1 = values(JTZZ1),
- ZZDH = values(ZZDH),
- TXDZ1 = values(TXDZ1),
- DZYJ = values(DZYJ),
- BYXX = values(BYXX),
- XL = values(XL),
- XW = values(XW),
- ZC = values(ZC),
- ZYZC = values(ZYZC),
- BYSJ = values(BYSJ),
- WYYZ = values(WYYZ),
- SLCD = values(SLCD),
- CSDZ = values(CSDZ),
- JTZZ2 = values(JTZZ2),
- YZBM = values(YZBM),
- TXDZ2 = values(TXDZ2),
- GJKJBXKLY = values(GJKJBXKLY),
- GJJJWXKLY = values(GJJJWXKLY),
- SYGB = values(SYGB),
- SYNF = values(SYNF),
- YS = values(YS),
- BSH = values(BSH),
- YDDH = values(YDDH),
- CZ = values(CZ),
- CHJLJRYCHQK = values(CHJLJRYCHQK),
- XTYH = values(XTYH),
- BM = values(BM),
- CJR = values(CJR)
- </insert>
- <!--通过主键修改数据-->
- <update id="update">
- update base_Person
- set
- DW = #{dw},
- XM = #{xm},
- XB = #{xb},
- MZ = #{mz},
- CSDZ = #{csdz},
- CSRQ = #{csrq},
- DP = #{dp},
- HGHQ = #{hghq},
- GDDH = #{gddh},
- JTZZ1 = #{jtzz1},
- ZZDH = #{zzdh},
- TXDZ1 = #{txdz1},
- DZYJ = #{dzyj},
- BYXX = #{byxx},
- XL = #{xl},
- XW = #{xw},
- ZC = #{zc},
- ZYZC = #{zyzc},
- BYSJ = #{bysj},
- WYYZ = #{wyyz},
- SLCD = #{slcd},
- YZBM = #{yzbm},
- GJKJBXKLY = #{gjkjbxkly},
- GJJJWXKLY = #{gjjjwxkly},
- SYGB = #{sygb},
- SYNF = #{synf},
- YS = #{ys},
- BSH = #{bsh},
- YDDH = #{yddh},
- CZ = #{cz},
- CHJLJRYCHQK = #{chjljrychqk},
- BM = #{bm}
- where ID = #{id}
- </update>
- <!--通过主键删除-->
- <delete id="deleteById">
- delete from base_Person where ID = #{id}
- </delete>
- <!--统计总行数-->
- <select id="count" resultType="java.lang.Long">
- select count(1)
- from base_Person p left join base_Company c on p.DW = c.ID
- left join sys_dept_info d on d.dept_id = p.BM
- <where>
- <if test="dwmc != null and dwmc != ''">
- and c.MC = #{dwcm}
- </if>
- <if test="xm != null and xm != ''">
- and p.XM = #{xm}
- </if>
- <if test="bmmc != null and bmmc != null">
- and d.dept_name = #{bmmc}
- </if>
- </where>
- </select>
- <!--分页查询-->
- <select id="getBasePersonList" resultMap="BasePersonMap" parameterType="map">
- select p.*, c.MC as DWMC, d.dept_name as BMMC, e.MC as XLMC, z.name as ZCMC, t.name as DWXZMC
- from base_Person p
- left join base_Company c on p.DW = c.ID
- left join sys_dept_info d on p.BM = d.dept_id
- left join base_Education e on p.XL = e.ID
- left join base_Title z on p.ZC = z.id
- left join base_CompanyType t on c.DWXZ = t.id
- where 1=1
- <if test="dwmc != null and dwmc != ''">
- and c.MC like '%'+#{dwmc}+'%'
- </if>
- <if test="xm != null and xm != ''">
- and p.XM like '%'+#{xm}+'%'
- </if>
- <if test="bmmc != null and bmmc != ''">
- and d.dept_name like '%'+#{bmmc}+'%'
- </if>
- order by p.ID asc
- </select>
- <!--获取项目负责人-->
- <select id="getDKYFZR" resultType="map">
- select p.ID as code, p.XM as name
- from base_Person p left join base_Company c on c.ID = p.DW
- </select>
- <!--批量删除单位-->
- <delete id="batchDelete" parameterType="java.util.ArrayList">
- delete from base_Person
- where ID in
- <foreach item="item" index="index" collection="idList" open = "(" separator = "," close = ")">
- #{item}
- </foreach>
- </delete>
- <!--获取单位人员-->
- <select id="getPersonListByDw" resultMap="BasePersonMap">
- select p.*, c.MC as DWMC
- from base_Person p
- left join base_Company c on p.DW = c.ID
- where DW = #{dw}
- <if test="xm != null and xm != ''">
- and p.XM like '%'+#{xm}+'%'
- </if>
- order by p.ID asc
- </select>
- </mapper>
|