2020-05-07 18:32:25 +08:00

138 lines
6.5 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.ruoyi.project.system.mapper.ByClassMapper">
<resultMap type="ByClass" id="ByClassResult">
<result property="bjbh" column="bjbh"/>
<result property="deptId" column="dept_id"/>
<result property="bjtype" column="bjtype"/>
<result property="bhxh" column="bhxh"/>
<result property="xn" column="xn"/>
<result property="bjmc" column="bjmc"/>
<result property="bjrych" column="bjrych"/>
<result property="jbny" column="jbny"/>
<result property="zbjs" column="zbjs"/>
<result property="zbjsxm" column="zbjsxm"/>
<result property="pbjs" column="pbjs"/>
<result property="pbjsxm" column="pbjsxm"/>
<result property="zljs" column="zljs"/>
<result property="zljsxm" column="zljsxm"/>
<result property="isdel" column="isdel"/>
<result property="createtime" column="createtime"/>
</resultMap>
<sql id="selectByClassVo">
select bjbh, dept_id, bjtype, bhxh, xn, bjmc, bjrych, jbny,
zbjs, (select nick_name from sys_user where sys_user.user_id=zbjs) zbjsxm,
pbjs, (select nick_name from sys_user where sys_user.user_id=pbjs) pbjsxm,
zljs, (select nick_name from sys_user where sys_user.user_id=zljs) zljsxm,
isdel, createtime from by_class d
</sql>
<select id="selectByClassList" parameterType="ByClass" resultMap="ByClassResult">
<include refid="selectByClassVo"/>
where isdel='0'
<if test="deptId != null and deptId != ''">and dept_id = #{deptId}</if>
<if test="bjtype != null and bjtype != ''">and bjtype = #{bjtype}</if>
<if test="bhxh != null ">and bhxh = #{bhxh}</if>
<if test="xn != null and xn != ''">and xn = #{xn}</if>
<if test="bjmc != null and bjmc != ''">and bjmc like concat('%', #{bjmc}, '%')</if>
<if test="bjrych != null and bjrych != ''">and bjrych = #{bjrych}</if>
<if test="jbny != null ">and jbny = #{jbny}</if>
<if test="zbjs != null ">and zbjs = #{zbjs}</if>
<if test="pbjs != null ">and pbjs = #{pbjs}</if>
<if test="zljs != null ">and zljs = #{zljs}</if>
<if test="zbjsxm != null and zbjsxm != ''" >and zbjsxm like concat('%', #{zbjsxm}, '%')</if>
<if test="pbjsxm != null and pbjsxm != ''" >and pbjsxm like concat('%', #{pbjsxm}, '%')</if>
<if test="zljsxm != null and zljsxm != ''" >and zljsxm like concat('%', #{zljsxm}, '%')</if>
<if test="isdel != null and isdel != ''">and isdel = #{isdel}</if>
<if test="createtime != null ">and createtime = #{createtime}</if>
<!-- 数据范围过滤 -->
${dataScope}
order by createtime desc
</select>
<select id="selectByClassById" parameterType="String" resultMap="ByClassResult">
<include refid="selectByClassVo"/>
where bjbh = #{bjbh}
</select>
<select id="selectByClassByUserId" parameterType="ByClass" resultMap="ByClassResult">
<include refid="selectByClassVo"/>
<where>
<if test="zbjs != null ">and zbjs = #{zbjs}</if>
<if test="pbjs != null ">and pbjs = #{pbjs}</if>
<if test="zljs != null ">and zljs = #{zljs}</if>
</where>
<!-- 数据范围过滤 -->
${dataScope}
</select>
<insert id="insertByClass" parameterType="ByClass">
insert into by_class
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="bjbh != null and bjbh != ''">bjbh,</if>
<if test="deptId != null and deptId != ''">dept_id,</if>
<if test="bjtype != null and bjtype != ''">bjtype,</if>
<if test="bhxh != null ">bhxh,</if>
<if test="xn != null and xn != ''">xn,</if>
<if test="bjmc != null and bjmc != ''">bjmc,</if>
<if test="bjrych != null and bjrych != ''">bjrych,</if>
<if test="jbny != null ">jbny,</if>
<if test="zbjs != null ">zbjs,</if>
<if test="pbjs != null ">pbjs,</if>
<if test="zljs != null ">zljs,</if>
<if test="isdel != null and isdel != ''">isdel,</if>
<if test="createtime != null ">createtime,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="bjbh != null and bjbh != ''">#{bjbh},</if>
<if test="deptId != null and deptId != ''">#{deptId},</if>
<if test="bjtype != null and bjtype != ''">#{bjtype},</if>
<if test="bhxh != null ">#{bhxh},</if>
<if test="xn != null and xn != ''">#{xn},</if>
<if test="bjmc != null and bjmc != ''">#{bjmc},</if>
<if test="bjrych != null and bjrych != ''">#{bjrych},</if>
<if test="jbny != null ">#{jbny},</if>
<if test="zbjs != null ">#{zbjs},</if>
<if test="pbjs != null ">#{pbjs},</if>
<if test="zljs != null ">#{zljs},</if>
<if test="isdel != null and isdel != ''">#{isdel},</if>
<if test="createtime != null ">#{createtime},</if>
</trim>
</insert>
<update id="updateByClass" parameterType="ByClass">
update by_class
<trim prefix="SET" suffixOverrides=",">
<if test="deptId != null and deptId != ''">dept_id = #{deptId},</if>
<if test="bjtype != null and bjtype != ''">bjtype = #{bjtype},</if>
<if test="bhxh != null ">bhxh = #{bhxh},</if>
<if test="xn != null and xn != ''">xn = #{xn},</if>
<if test="bjmc != null and bjmc != ''">bjmc = #{bjmc},</if>
<if test="bjrych != null and bjrych != ''">bjrych = #{bjrych},</if>
<if test="jbny != null ">jbny = #{jbny},</if>
<if test="zbjs != null ">zbjs = #{zbjs},</if>
<if test="pbjs != null ">pbjs = #{pbjs},</if>
<if test="zljs != null ">zljs = #{zljs},</if>
<if test="isdel != null and isdel != ''">isdel = #{isdel},</if>
<if test="createtime != null ">createtime = #{createtime},</if>
</trim>
where bjbh = #{bjbh}
</update>
<delete id="deleteByClassById" parameterType="String">
update by_class set isdel='1'where bjbh = #{bjbh}
</delete>
<delete id="deleteByClassByIds" parameterType="String">
update by_class set isdel='1' where bjbh in
<foreach item="bjbh" collection="array" open="(" separator="," close=")">
#{bjbh}
</foreach>
</delete>
</mapper>