123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- <?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.pssr.mapper.TPssrMaterialRawMapper">
- <resultMap type="TPssrMaterialRaw" id="TPssrMaterialRawResult">
- <result property="id" column="id" />
- <result property="subId" column="sub_id" />
- <result property="approveId" column="approve_id" />
- <result property="rawMaterial" column="raw_material" />
- <result property="quantity" column="quantity" />
- <result property="unit" column="unit" />
- <result property="note" column="note" />
- <result property="confirm1" column="confirm1" />
- <result property="confirm2" column="confirm2" />
- <result property="confirmationDate" column="confirmation_date" />
- <result property="delFlag" column="del_flag" />
- <result property="createrCode" column="creater_code" />
- <result property="createdate" column="createdate" />
- <result property="updaterCode" column="updater_code" />
- <result property="updatedate" column="updatedate" />
- <result property="deptId" column="dept_id" />
- <result property="remarks" column="remarks" />
- <result property="approveStatus" column="approve_status" />
- <result property="deptName" column="dept_name" />
- <result property="confirm1Name" column="confirm1_name" />
- <result property="confirm2Name" column="confirm2_name" />
- </resultMap>
- <sql id="selectTPssrMaterialRawVo">
- select d.id, u1.nick_name confirm1_name, u2.nick_name confirm2_name, d.sub_id, d.approve_id, d.raw_material, d.quantity, d.unit, d.note, d.confirm1, d.confirm2, d.confirmation_date, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.dept_id, d.remarks, d.approve_status ,s.dept_name from t_pssr_material_raw d
- left join sys_dept s on s.dept_id = d.dept_id
- left join sys_user u1 on u1.user_id = d.CONFIRM1
- left join sys_user u2 on u2.user_id = d.CONFIRM2
- </sql>
- <select id="selectNoConfirmCount" parameterType="Long" resultType="int">
- select count(1) from t_pssr_Material_Raw d where sub_id = #{subId} and (confirm1 is null) and d.del_flag = 0
- </select>
- <select id="selectTPssrMaterialRawList" parameterType="TPssrMaterialRaw" resultMap="TPssrMaterialRawResult">
- <include refid="selectTPssrMaterialRawVo"/>
- <where>
- <if test="subId != null "> and sub_id = #{subId}</if>
- <if test="approveId != null "> and approve_id = #{approveId}</if>
- <if test="rawMaterial != null and rawMaterial != ''"> and raw_material = #{rawMaterial}</if>
- <if test="quantity != null and quantity != ''"> and quantity = #{quantity}</if>
- <if test="unit != null and unit != ''"> and unit = #{unit}</if>
- <if test="note != null and note != ''"> and note = #{note}</if>
- <if test="confirm1 != null and confirm1 != ''"> and confirm1 = #{confirm1}</if>
- <if test="confirm2 != null and confirm2 != ''"> and confirm2 = #{confirm2}</if>
- <if test="confirmationDate != null "> and confirmation_date = #{confirmationDate}</if>
- <if test="createrCode != null and createrCode != ''"> and creater_code = #{createrCode}</if>
- <if test="createdate != null "> and createdate = #{createdate}</if>
- <if test="updaterCode != null and updaterCode != ''"> and updater_code = #{updaterCode}</if>
- <if test="updatedate != null "> and updatedate = #{updatedate}</if>
- <if test="deptId != null "> and dept_id = #{deptId}</if>
- <if test="remarks != null"> and remarks = #{remarks}</if>
- <if test="approveStatus != null "> and approve_status = #{approveStatus}</if>
- and d.del_flag = 0
- </where>
- <!-- 数据范围过滤 -->
- ${params.dataScope}
- order by
- CASE
- WHEN confirm1 IS NULL AND confirm2 IS NULL THEN 0
- WHEN confirm1 IS NULL OR confirm2 IS NULL THEN 1
- ELSE 2
- END,id desc
- </select>
- <select id="selectTPssrMaterialRawById" parameterType="Long" resultMap="TPssrMaterialRawResult">
- <include refid="selectTPssrMaterialRawVo"/>
- where id = #{id}
- </select>
- <select id="selectAllConfirmedPersonBySubId" parameterType="TPssrMaterialRaw" resultMap="TPssrMaterialRawResult">
- SELECT
- LISTAGG(CONFIRM1, ',') WITHIN GROUP (ORDER BY CONFIRM1) AS CONFIRM1,
- LISTAGG(CONFIRM2, ',') WITHIN GROUP (ORDER BY CONFIRM2) AS CONFIRM2
- FROM (
- SELECT DISTINCT CONFIRM1, CONFIRM2 FROM t_pssr_material_raw WHERE sub_id = #{subId}
- <if test="approveStatus != null ">AND approve_status = #{approveStatus}</if>
- and del_flag = 0
- UNION
- SELECT DISTINCT CONFIRM1, CONFIRM2 FROM t_pssr_material WHERE sub_id = #{subId}
- <if test="approveStatus != null "> AND approve_status = #{approveStatus}</if>
- and del_flag = 0
- )
- </select>
- <insert id="insertTPssrMaterialRaw" parameterType="TPssrMaterialRaw">
- <selectKey keyProperty="id" resultType="long" order="BEFORE">
- SELECT seq_t_pssr_material_raw.NEXTVAL as id FROM DUAL
- </selectKey>
- insert into t_pssr_material_raw
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">id,</if>
- <if test="subId != null">sub_id,</if>
- <if test="approveId != null">approve_id,</if>
- <if test="rawMaterial != null">raw_material,</if>
- <if test="quantity != null">quantity,</if>
- <if test="unit != null">unit,</if>
- <if test="note != null">note,</if>
- <if test="confirm1 != null">confirm1,</if>
- <if test="confirm2 != null">confirm2,</if>
- <if test="confirmationDate != null">confirmation_date,</if>
- <if test="delFlag != null">del_flag,</if>
- <if test="createrCode != null">creater_code,</if>
- <if test="createdate != null">createdate,</if>
- <if test="updaterCode != null">updater_code,</if>
- <if test="updatedate != null">updatedate,</if>
- <if test="deptId != null">dept_id,</if>
- <if test="remarks != null">remarks,</if>
- <if test="approveStatus != null">approve_status,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">#{id},</if>
- <if test="subId != null">#{subId},</if>
- <if test="approveId != null">#{approveId},</if>
- <if test="rawMaterial != null">#{rawMaterial},</if>
- <if test="quantity != null">#{quantity},</if>
- <if test="unit != null">#{unit},</if>
- <if test="note != null">#{note},</if>
- <if test="confirm1 != null">#{confirm1},</if>
- <if test="confirm2 != null">#{confirm2},</if>
- <if test="confirmationDate != null">#{confirmationDate},</if>
- <if test="delFlag != null">#{delFlag},</if>
- <if test="createrCode != null">#{createrCode},</if>
- <if test="createdate != null">#{createdate},</if>
- <if test="updaterCode != null">#{updaterCode},</if>
- <if test="updatedate != null">#{updatedate},</if>
- <if test="deptId != null">#{deptId},</if>
- <if test="remarks != null">#{remarks},</if>
- <if test="approveStatus != null">#{approveStatus},</if>
- </trim>
- </insert>
- <update id="updateAllBySubId" parameterType="TPssrMaterialRaw">
- update t_pssr_material_raw
- <trim prefix="SET" suffixOverrides=",">
- <if test="approveStatus != null">approve_status = #{approveStatus},</if>
- <if test="updaterCode != null">updater_code = #{updaterCode},</if>
- <if test="updatedate != null">updatedate = #{updatedate},</if>
- </trim>
- where sub_id= #{subId} and APPROVE_STATUS=0
- </update>
- <update id="updateTPssrMaterialRaw" parameterType="TPssrMaterialRaw">
- update t_pssr_material_raw
- <trim prefix="SET" suffixOverrides=",">
- <if test="subId != null">sub_id = #{subId},</if>
- <if test="approveId != null">approve_id = #{approveId},</if>
- <if test="rawMaterial != null">raw_material = #{rawMaterial},</if>
- <if test="quantity != null">quantity = #{quantity},</if>
- <if test="unit != null">unit = #{unit},</if>
- <if test="note != null">note = #{note},</if>
- <if test="confirm1 != null">confirm1 = #{confirm1},</if>
- <if test="confirm2 != null">confirm2 = #{confirm2},</if>
- <if test="confirmationDate != null">confirmation_date = #{confirmationDate},</if>
- <if test="delFlag != null">del_flag = #{delFlag},</if>
- <if test="createrCode != null">creater_code = #{createrCode},</if>
- <if test="createdate != null">createdate = #{createdate},</if>
- <if test="updaterCode != null">updater_code = #{updaterCode},</if>
- <if test="updatedate != null">updatedate = #{updatedate},</if>
- <if test="deptId != null">dept_id = #{deptId},</if>
- <if test="remarks != null ">remarks = #{remarks},</if>
- <if test="approveStatus != null">approve_status = #{approveStatus},</if>
- </trim>
- where id = #{id}
- </update>
- <update id="updateTPssrMaterialRawByIds" parameterType="TPssrMaterialRaw">
- update t_pssr_material_raw
- <trim prefix="SET" suffixOverrides=",">
- <if test="confirm1 != null">confirm1 = #{confirm1},</if>
- <if test="confirm2 != null">confirm2 = #{confirm2},</if>
- <if test="confirmationDate != null">confirmation_date = #{confirmationDate},</if>
- <if test="createrCode != null">creater_code = #{createrCode},</if>
- <if test="createdate != null">createdate = #{createdate},</if>
- <if test="updaterCode != null">updater_code = #{updaterCode},</if>
- <if test="updatedate != null">updatedate = #{updatedate},</if>
- <if test="remarks != null ">remarks = #{remarks},</if>
- </trim>
- where id in
- <foreach item="id" collection="ids" open="(" separator="," close=")">
- #{id}
- </foreach>
- </update>
- <update id="deleteTPssrMaterialRawById" parameterType="Long">
- update t_pssr_material_raw set del_flag = 2 where id = #{id}
- </update>
- <update id="deleteTPssrMaterialRawByIds" parameterType="String">
- update t_pssr_material_raw set del_flag = 2 where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </update>
- </mapper>
|