123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293 |
- <?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.zhyc.xps.common.mapper.ChecklistMapper">
- <resultMap id="ChecklistDtoResultMap" type="com.zhyc.xps.common.dto.ChecklistDto">
- <result column="oc_id" property="ocId" jdbcType="BIGINT" /><!--单位ID-->
- <result column="checklist_id" property="checklistId" jdbcType="BIGINT" /><!--清单ID-->
- <result column="checklist_cat_id" property="checklistCatId" jdbcType="BIGINT" />
- <result column="checklist_cat_title" property="checklistCatTitle" jdbcType="VARCHAR" />
- <result column="checklist_type_id" property="checklistTypeId" jdbcType="BIGINT" />
- <result column="checklist_title" property="checklistTitle" jdbcType="VARCHAR" />
- <result column="checklist_desc" property="checklistDesc" jdbcType="VARCHAR" />
- <result column="is_fixed" property="isFixed" jdbcType="BIGINT" />
- <result column="issued_at" property="issuedAt" jdbcType="TIMESTAMP"/>
- <result column="author" property="author" jdbcType="VARCHAR" />
- <result column="status" property="status" jdbcType="BIGINT" />
- <result column="version" property="version" jdbcType="VARCHAR" />
- <result column="issued_account_id" property="issuedAccountId" jdbcType="BIGINT" />
- <result column="issued_account_name" property="issuedAccountName" jdbcType="VARCHAR" />
- </resultMap>
- <sql id="ChecklistDto_Cols">
- A.oc_id,
- A.checklist_id,
- A.checklist_cat_id,
- B.checklist_cat_title,
- A.checklist_type_id,
- A.checklist_desc,
- A.checklist_title,
- A.is_fixed,
- C.account_name AS issued_account_name,
- A.issued_by AS issued_account_id,
- A.issued_at,
- A.author,
- A.status,
- A.version
- </sql>
- <!--根据ID获取信息-->
- <select id="getById" resultMap="ChecklistDtoResultMap">
- SELECT
- <include refid="ChecklistDto_Cols"/>
- FROM checklist AS A
- LEFT JOIN checklist_cat AS B ON (A.oc_id = B.oc_id AND A.checklist_cat_id = B.checklist_cat_id)
- LEFT JOIN account AS C ON (A.oc_id = C.oc_id AND A.issued_by = C.account_id)
- WHERE A.deleted_flag = 0
- <if test="ocId != null">
- AND A.oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="checklistId !=null">
- AND A.checklist_id = #{checklistId ,jdbcType=BIGINT}
- </if>
- </select>
- <!--根据ID获取信息-->
- <select id="getByChecklistId" resultMap="ChecklistDtoResultMap">
- SELECT
- <include refid="ChecklistDto_Cols"/>
- FROM checklist AS A
- LEFT JOIN checklist_cat AS B ON (A.oc_id = B.oc_id AND A.checklist_cat_id = B.checklist_cat_id)
- LEFT JOIN account AS C ON (A.oc_id = C.oc_id AND A.issued_by = C.account_id)
- WHERE A.deleted_flag = 0
- <if test="checklistId !=null">
- AND A.checklist_id = #{checklistId ,jdbcType=BIGINT}
- </if>
- </select>
- <!--获取列表-->
- <select id="getByList" resultMap="ChecklistDtoResultMap" parameterType="java.util.Map">
- SELECT
- <include refid="ChecklistDto_Cols"/>
- FROM checklist AS A
- LEFT JOIN checklist_cat AS B ON (A.oc_id = B.oc_id AND A.checklist_cat_id = B.checklist_cat_id)
- LEFT JOIN account AS C ON (A.oc_id = C.oc_id AND A.issued_by = C.account_id)
- WHERE A.deleted_flag = 0
- <if test="ocId != null">
- AND A.oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="checklistId !=null">
- AND A.checklist_id = #{checklistId ,jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- AND A.checklist_title like "%"#{keywords}"%"
- </if>
- <if test="checklistTypeId != null">
- AND A.checklist_type_id = #{checklistTypeId ,jdbcType=BIGINT}
- </if>
- <if test="status != null">
- AND A.status = #{status ,jdbcType=BIGINT}
- </if>
- ORDER BY A.checklist_id
- </select>
- <!--分页获取-->
- <select id="getByPage" resultMap="ChecklistDtoResultMap" parameterType="java.util.Map">
- SELECT
- <include refid="ChecklistDto_Cols"/>
- FROM checklist AS A
- LEFT JOIN checklist_cat AS B ON (A.oc_id = B.oc_id AND A.checklist_cat_id = B.checklist_cat_id)
- LEFT JOIN account AS C ON (A.oc_id = C.oc_id AND A.issued_by = C.account_id)
- WHERE A.deleted_flag = 0
- <if test="ocId != null">
- AND A.oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="checklistId !=null">
- AND A.checklist_id = #{checklistId ,jdbcType=BIGINT}
- </if>
- <if test="checklistCatId != null">
- AND A.checklist_cat_id = #{checklistCatId, jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- AND A.checklist_title like "%"#{keywords}"%"
- </if>
- <if test="checklistTypeId != null">
- AND A.checklist_type_id = #{checklistTypeId ,jdbcType=BIGINT}
- </if>
- <if test="status != null">
- AND A.status = #{status ,jdbcType=BIGINT}
- </if>
- ORDER BY A.checklist_id
- </select>
- <!--Create-->
- <insert id="create" parameterType="com.zhyc.xps.common.entity.Checklist" keyProperty="checklistId">
- INSERT INTO checklist
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- oc_id,
- </if>
- <if test="checklistId != null">
- checklist_id,
- </if>
- <if test="checklistCatId != null">
- checklist_cat_id,
- </if>
- <if test="checklistTypeId != null">
- checklist_type_id,
- </if>
- <if test="checklistTitle != null and checklistTitle!=''">
- checklist_title,
- </if>
- <if test="checklistDesc != null and checklistDesc != ''">
- checklist_desc,
- </if>
- <if test="isFixed != null">
- is_fixed,
- </if>
- <if test="issuedBy != null">
- issued_by,
- </if>
- <if test="issuedAt != null">
- issued_at,
- </if>
- <if test="author != null and author != ''">
- author,
- </if>
- <if test="status != null">
- status,
- </if>
- <if test="version != null and version != ''">
- version,
- </if>
- <if test="createdBy != null">
- created_by,
- </if>
- <if test="createdAt != null">
- created_at,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- #{ocId ,jdbcType=BIGINT},
- </if>
- <if test="checklistId != null">
- #{checklistId ,jdbcType=BIGINT},
- </if>
- <if test="checklistCatId != null">
- #{checklistCatId ,jdbcType=BIGINT},
- </if>
- <if test="checklistTypeId != null">
- #{checklistTypeId ,jdbcType=BIGINT},
- </if>
- <if test="checklistTitle != null and checklistTitle!=''">
- #{checklistTitle ,jdbcType=VARCHAR},
- </if>
- <if test="checklistDesc != null and checklistDesc != ''">
- #{checklistDesc ,jdbcType=VARCHAR},
- </if>
- <if test="isFixed != null">
- #{isFixed ,jdbcType=BIGINT},
- </if>
- <if test="issuedBy != null">
- #{issuedBy ,jdbcType=BIGINT},
- </if>
- <if test="issuedAt != null">
- #{issuedAt ,jdbcType=TIMESTAMP},
- </if>
- <if test="author != null and author != ''">
- #{author ,jdbcType=VARCHAR},
- </if>
- <if test="status != null">
- #{status ,jdbcType=BIGINT},
- </if>
- <if test="version != null and version != ''">
- #{version ,jdbcType=VARCHAR},
- </if>
- <if test="createdBy != null">
- #{createdBy ,jdbcType=BIGINT},
- </if>
- <if test="createdAt != null">
- #{createdAt ,jdbcType=TIMESTAMP},
- </if>
- </trim>
- </insert>
- <!--更新-->
- <update id="update" parameterType="com.zhyc.xps.common.entity.Checklist">
- UPDATE checklist
- <trim suffixOverrides=",">
- <set>
- <if test="checklistCatId != null">
- checklist_cat_id = #{checklistCatId ,jdbcType=BIGINT},
- </if>
- <if test="checklistTypeId != null">
- checklist_type_id = #{checklistTypeId ,jdbcType=BIGINT},
- </if>
- <if test="checklistTitle != null">
- checklist_title =#{checklistTitle ,jdbcType=VARCHAR},
- </if>
- <if test="checklistDesc != null and checklistDesc != ''">
- checklist_desc = #{checklistDesc ,jdbcType=VARCHAR},
- </if>
- <if test="isFixed != null">
- is_fixed = #{isFixed ,jdbcType=BIGINT},
- </if>
- <if test="issuedBy != null">
- issued_by = #{issuedBy ,jdbcType=BIGINT},
- </if>
- <if test="issuedAt != null">
- issued_at = #{issuedAt ,jdbcType=TIMESTAMP},
- </if>
- <if test="author != null and author != ''">
- author = #{author ,jdbcType=VARCHAR},
- </if>
- <if test="status != null">
- status = #{status ,jdbcType=BIGINT},
- </if>
- <if test="version != null and version != ''">
- version = #{version ,jdbcType=VARCHAR},
- </if>
- <if test="updatedBy != null">
- updated_by = #{updatedBy ,jdbcType=BIGINT},
- </if>
- <if test="updatedAt != null">
- updated_at = #{updatedAt ,jdbcType=TIMESTAMP},
- </if>
- </set>
- </trim>
- WHERE 1 = 1
- <if test="ocId != null">
- AND oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="checklistId != null">
- AND checklist_id = #{checklistId ,jdbcType=BIGINT}
- </if>
- </update>
- <!--删除 -->
- <update id="delete" parameterType="java.util.Map">
- UPDATE checklist
- <trim suffixOverrides=",">
- <set>
- <if test="deletedBy != null">
- deleted_by = #{deletedBy ,jdbcType=BIGINT},
- </if>
- <if test="deletedAt != null">
- deleted_at = #{deletedAt ,jdbcType=DATE},
- </if>
- <if test="deletedFlag != null">
- deleted_flag = #{deletedFlag ,jdbcType=BIGINT},
- </if>
- </set>
- </trim>
- WHERE deleted_flag = 0
- <if test="ocId != null">
- AND oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="checklistId != null ">
- AND checklist_id = #{checklistId ,jdbcType=BIGINT}
- </if>
- </update>
- </mapper>
|