123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- <?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.supervision.bdglregular.mapper.BdglRegularMapper">
- <resultMap type="BdglRegular" id="BdglRegularResult">
- <result property="id" column="id" />
- <result property="inspectedUnitId" column="inspected_unit_id" />
- <result property="inspectedUnit" column="inspected_unit" />
- <result property="inspectionType" column="inspection_type" />
- <result property="unitCheckId" column="unit_check_id" />
- <result property="unitCheck" column="unit_check" />
- <result property="inspectionTime" column="inspection_time" />
- <result property="inspectionSite" column="inspection_site" />
- <result property="score" column="score" />
- <result property="rectificationTime" column="rectification_time" />
- <result property="currentState" column="current_state" />
- <result property="question" column="question" />
- <result property="createTime" column="create_time" />
- <result property="createUserId" column="create_user_id" />
- <result property="createUser" column="create_user" />
- <result property="updateTime" column="update_time" />
- <result property="chargePeopleId" column="charge_people_id" />
- <result property="chargePeople" column="charge_people" />
- <result property="correctiveAction" column="corrective_action" />
- <result property="pictureProof" column="picture_proof" />
- <result property="documentProof" column="document_proof" />
- <result property="caoZuoType" column="caozuo_type" />
- <result property="reasonReturn" column="reason_return" />
- <result property="parentId" column="parent_id" />
- <result property="paixuValue" column="paixu_value" />
- <result property="wenjianname" column="wenjianname" />
- </resultMap>
- <sql id="selectBdglRegularVo">
- select id, inspected_unit_id, inspected_unit, inspection_type, unit_check_id, unit_check, inspection_time, inspection_site, score, rectification_time, current_state, question, create_time, create_user_id, create_user, update_time, charge_people_id, charge_people, corrective_action, picture_proof, document_proof,caozuo_type,reason_return,parent_id,paixu_value,wenjianname from bdgl_regular
- </sql>
- <select id="selectBdglRegularList" parameterType="BdglRegular" resultMap="BdglRegularResult">
- <include refid="selectBdglRegularVo"/>
- <where>
- <if test="inspectedUnitId != null "> and inspected_unit_id = #{inspectedUnitId}</if>
- <if test="inspectedUnit != null and inspectedUnit != ''">and inspected_unit = #{inspectedUnit}</if>
- <if test="inspectionType != null and inspectionType != ''"> and inspection_type = #{inspectionType}</if>
- <if test="unitCheckId != null "> and unit_check_id = #{unitCheckId}</if>
- <if test="unitCheck != null and unitCheck != ''"> and unit_check = #{unitCheck}</if>
- <if test="inspectionTime != null and inspectionTime != ''"> and inspection_time = #{inspectionTime}</if>
- <if test="inspectionSite != null and inspectionSite != ''"> and inspection_site = #{inspectionSite}</if>
- <if test="score != null "> and score = #{score}</if>
- <if test="rectificationTime != null and rectificationTime != ''"> and rectification_time = #{rectificationTime}</if>
- <if test="currentState != null and currentState != ''"> and current_state = #{currentState}</if>
- <if test="question != null and question != ''"> and question = #{question}</if>
- <if test="createUserId != null "> and create_user_id = #{createUserId}</if>
- <if test="createUser != null and createUser != ''"> and create_user = #{createUser}</if>
- <if test="chargePeopleId != null "> and charge_people_id = #{chargePeopleId}</if>
- <if test="chargePeople != null and chargePeople != ''"> and charge_people = #{chargePeople}</if>
- <if test="correctiveAction != null and correctiveAction != ''"> and corrective_action = #{correctiveAction}</if>
- <if test="pictureProof != null and pictureProof != ''"> and picture_proof = #{pictureProof}</if>
- <if test="documentProof != null and documentProof != ''"> and document_proof = #{documentProof}</if>
- <if test="caoZuoType != null and caoZuoType != ''"> and caozuo_type = #{caoZuoType}</if>
- <if test="reasonReturn != null and reasonReturn != ''"> and reason_return = #{reasonReturn}</if>
- <if test="parentId != null "> and parent_id = #{parentId}</if>
- <if test="paixuValue != null and paixuValue != '' "> and paixu_value = #{paixuValue}</if>
- <if test="wenjianname != null and wenjianname != '' "> and wenjianname = #{wenjianname}</if>
- and YEAR(inspection_time) = YEAR(NOW())
- </where>
- order by paixu_value asc
- </select>
- <select id="selectBdglRegularLists" parameterType="BdglRegular" resultMap="BdglRegularResult">
- select id, inspected_unit_id, inspected_unit, inspection_type, unit_check_id, unit_check, inspection_time, inspection_site, r.score, rectification_time, current_state, question, r.create_time, create_user_id, create_user, r.update_time, charge_people_id, charge_people, corrective_action, picture_proof, document_proof,caozuo_type,reason_return,r.parent_id,paixu_value, wenjianname
- from bdgl_regular r left join sys_dept d
- on r.inspected_unit_id=d.dept_id
- <where>
- <if test="inspectedUnitId != null ">
- and (r.inspected_unit_id = #{inspectedUnitId} or d.ancestors like concat('%', #{inspectedUnitId}, '%'))
- </if>
- <if test="inspectedUnit != null and inspectedUnit != ''"> and r.zinspected_unit = #{inspectedUnit}</if>
- <if test="inspectionType != null and inspectionType != ''"> and r.inspection_type = #{inspectionType}</if>
- <if test="unitCheckId != null "> and r.unit_check_id = #{unitCheckId}</if>
- <if test="unitCheck != null and unitCheck != ''"> and r.unit_check = #{unitCheck}</if>
- <if test="inspectionTime != null and inspectionTime != ''"> and r.inspection_time = #{inspectionTime}</if>
- <if test="inspectionSite != null and inspectionSite != ''"> and r.inspection_site = #{inspectionSite}</if>
- <if test="score != null "> and r.score = #{score}</if>
- <if test="rectificationTime != null and rectificationTime != ''"> and r.rectification_time = #{rectificationTime}</if>
- <if test="currentState != null and currentState != ''"> and r.current_state = #{currentState}</if>
- <if test="question != null and question != ''"> and r.question = #{question}</if>
- <if test="createUserId != null "> and r.create_user_id = #{createUserId}</if>
- <if test="createUser != null and createUser != ''"> and r.create_user = #{createUser}</if>
- <if test="chargePeopleId != null "> and r.charge_people_id = #{chargePeopleId}</if>
- <if test="chargePeople != null and chargePeople != ''"> and r.charge_people = #{chargePeople}</if>
- <if test="correctiveAction != null and correctiveAction != ''"> and r.corrective_action = #{correctiveAction}</if>
- <if test="pictureProof != null and pictureProof != ''"> and r.picture_proof = #{pictureProof}</if>
- <if test="documentProof != null and documentProof != ''"> and r.document_proof = #{documentProof}</if>
- <if test="caoZuoType != null and caoZuoType != ''"> and r.caozuo_type = #{caoZuoType}</if>
- <if test="reasonReturn != null and reasonReturn != ''"> and r.reason_return = #{reasonReturn}</if>
- <if test="parentId != null "> and r.parent_id = #{parentId}</if>
- <if test="paixuValue != null and paixuValue != '' "> and r.paixu_value = #{paixuValue}</if>
- <if test="wenjianname != null and wenjianname != '' "> and r.wenjianname = #{wenjianname}</if>
- and YEAR(inspection_time) = YEAR(NOW())
- </where>
- ORDER BY paixu_value
- </select>
- <!-- 查询出 如果部门ID 相同的数据 -->
- <select id="selectBdglRegularListByDeptId" parameterType="BdglRegular" resultMap="BdglRegularResult">
- <include refid="selectBdglRegularVo"/>
- WHERE inspected_unit_id = #{inspectedUnitId} OR unit_check_id = #{unitCheckId}
- </select>
- <select id="selectBdglRegularById" parameterType="Long" resultMap="BdglRegularResult">
- <include refid="selectBdglRegularVo"/>
- where id = #{id}
- </select>
- <insert id="insertBdglRegular" parameterType="BdglRegular">
- insert into bdgl_regular
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">id,</if>
- <if test="inspectedUnitId != null">inspected_unit_id,</if>
- <if test="inspectedUnit != null">inspected_unit,</if>
- <if test="inspectionType != null">inspection_type,</if>
- <if test="unitCheckId != null">unit_check_id,</if>
- <if test="unitCheck != null">unit_check,</if>
- <if test="inspectionTime != null">inspection_time,</if>
- <if test="inspectionSite != null">inspection_site,</if>
- <if test="score != null">score,</if>
- <if test="rectificationTime != null">rectification_time,</if>
- <if test="currentState != null">current_state,</if>
- <if test="question != null">question,</if>
- <if test="createTime != null">create_time,</if>
- <if test="createUserId != null">create_user_id,</if>
- <if test="createUser != null">create_user,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="chargePeopleId != null">charge_people_id,</if>
- <if test="chargePeople != null">charge_people,</if>
- <if test="correctiveAction != null">corrective_action,</if>
- <if test="pictureProof != null">picture_proof,</if>
- <if test="documentProof != null">document_proof,</if>
- <if test="caoZuoType != null "> caozuo_type ,</if>
- <if test="reasonReturn != null"> reason_return ,</if>
- <if test="parentId != null "> parent_id ,</if>
- <if test="paixuValue != null "> paixu_value ,</if>
- <if test="wenjianname != null "> wenjianname ,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">#{id},</if>
- <if test="inspectedUnitId != null">#{inspectedUnitId},</if>
- <if test="inspectedUnit != null">#{inspectedUnit},</if>
- <if test="inspectionType != null">#{inspectionType},</if>
- <if test="unitCheckId != null">#{unitCheckId},</if>
- <if test="unitCheck != null">#{unitCheck},</if>
- <if test="inspectionTime != null">#{inspectionTime},</if>
- <if test="inspectionSite != null">#{inspectionSite},</if>
- <if test="score != null">#{score},</if>
- <if test="rectificationTime != null">#{rectificationTime},</if>
- <if test="currentState != null">#{currentState},</if>
- <if test="question != null">#{question},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="createUserId != null">#{createUserId},</if>
- <if test="createUser != null">#{createUser},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="chargePeopleId != null">#{chargePeopleId},</if>
- <if test="chargePeople != null">#{chargePeople},</if>
- <if test="correctiveAction != null">#{correctiveAction},</if>
- <if test="pictureProof != null">#{pictureProof},</if>
- <if test="documentProof != null">#{documentProof},</if>
- <if test="caoZuoType != null "> #{caoZuoType},</if>
- <if test="reasonReturn != null "> #{reasonReturn},</if>
- <if test="parentId != null "> #{parentId},</if>
- <if test="paixuValue != null"> #{paixuValue},</if>
- <if test="wenjianname != null ">#{wenjianname},</if>
- </trim>
- </insert>
- <update id="updateBdglRegular" parameterType="BdglRegular">
- update bdgl_regular
- <trim prefix="SET" suffixOverrides=",">
- <if test="inspectedUnitId != null">inspected_unit_id = #{inspectedUnitId},</if>
- <if test="inspectedUnit != null">inspected_unit = #{inspectedUnit},</if>
- <if test="inspectionType != null">inspection_type = #{inspectionType},</if>
- <if test="unitCheckId != null">unit_check_id = #{unitCheckId},</if>
- <if test="unitCheck != null">unit_check = #{unitCheck},</if>
- <if test="inspectionTime != null">inspection_time = #{inspectionTime},</if>
- <if test="inspectionSite != null">inspection_site = #{inspectionSite},</if>
- <if test="score != null">score = #{score},</if>
- <if test="rectificationTime != null">rectification_time = #{rectificationTime},</if>
- <if test="currentState != null">current_state = #{currentState},</if>
- <if test="question != null">question = #{question},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="createUserId != null">create_user_id = #{createUserId},</if>
- <if test="createUser != null">create_user = #{createUser},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="chargePeopleId != null">charge_people_id = #{chargePeopleId},</if>
- <if test="chargePeople != null">charge_people = #{chargePeople},</if>
- <if test="correctiveAction != null">corrective_action = #{correctiveAction},</if>
- <if test="pictureProof != null">picture_proof = #{pictureProof},</if>
- <if test="documentProof != null">document_proof = #{documentProof},</if>
- <if test="caoZuoType != null "> caozuo_type = #{caoZuoType},</if>
- <if test="reasonReturn != null ">reason_return = #{reasonReturn},</if>
- <if test="parentId != null "> parent_id = #{parentId},</if>
- <if test="paixuValue != null "> paixu_value = #{paixuValue},</if>
- <if test="wenjianname != null "> wenjianname = #{wenjianname},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteBdglRegularById" parameterType="Long">
- delete from bdgl_regular where id = #{id}
- </delete>
- <!-- 查询当前部门以及部门下的数据 -->
- <select id="selectDeptById" parameterType="Long" resultMap="BdglRegularResult">
- <include refid="selectBdglRegularVo"/>
- WHERE id IN (SELECT id FROM bdgl_regular
- where inspected_unit_id = #{deptId} or parent_id = #{deptId}) and YEAR(inspection_time) = YEAR(NOW())
- </select>
- <!-- 查询当前部门以及部门下减分状态的数据 -->
- <select id="selectDeptByIdAndStates" resultMap="BdglRegularResult">
- <include refid="selectBdglRegularVo"/>
- where (inspected_unit_id = #{deptId} or parent_id = #{deptId}) and caozuo_type='0' and YEAR(inspection_time) = YEAR(NOW())
- </select>
- <delete id="deleteBdglRegularByIds" parameterType="String">
- delete from bdgl_regular where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|