hdy
6 天以前 31960ffca93463cf4f6d417576c8694aed84138e
billion-system/src/main/resources/mapper/system/SysDictTypeMapper.xml
@@ -1,7 +1,7 @@
<?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">
      PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
      "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.billion.system.mapper.SysDictTypeMapper">
   <resultMap type="SysDictType" id="SysDictTypeResult">
@@ -14,16 +14,16 @@
      <result property="updateBy"   column="update_by"   />
      <result property="updateTime" column="update_time" />
   </resultMap>
   <sql id="selectDictTypeVo">
        select dict_id, dict_name, dict_type, status, create_by, create_time, remark
      select dict_id, dict_name, dict_type, status, create_by, create_time, remark
      from sys_dict_type
    </sql>
   </sql>
   <select id="selectDictTypeList" parameterType="SysDictType" resultMap="SysDictTypeResult">
       <include refid="selectDictTypeVo"/>
      <include refid="selectDictTypeVo"/>
      <where>
          <if test="dictName != null and dictName != ''">
         <if test="dictName != null and dictName != ''">
            AND dict_name like concat('%', #{dictName}, '%')
         </if>
         <if test="status != null and status != ''">
@@ -33,73 +33,76 @@
            AND dict_type like concat('%', #{dictType}, '%')
         </if>
         <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
            and date_format(create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
            <!--            and <![CDATA[ create_time >= convert(datetime, #{params.beginTime}, 20)]]>-->
            and datediff(d, create_time, #{params.beginTime}) <![CDATA[<=]]> 0
         </if>
         <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
            and date_format(create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
            <!--            and <![CDATA[ create_time <= convert(datetime, #{params.endTime}, 20)]]>-->
            and datediff(d, create_time, #{params.endTime}) <![CDATA[>=]]> 0
         </if>
       </where>
      </where>
   </select>
   <select id="selectDictTypeAll" resultMap="SysDictTypeResult">
      <include refid="selectDictTypeVo"/>
   </select>
   <select id="selectDictTypeById" parameterType="Long" resultMap="SysDictTypeResult">
      <include refid="selectDictTypeVo"/>
      where dict_id = #{dictId}
   </select>
   <select id="selectDictTypeByType" parameterType="String" resultMap="SysDictTypeResult">
      <include refid="selectDictTypeVo"/>
      where dict_type = #{dictType}
   </select>
   <select id="checkDictTypeUnique" parameterType="String" resultMap="SysDictTypeResult">
      <include refid="selectDictTypeVo"/>
      where dict_type = #{dictType} limit 1
   </select>
   <delete id="deleteDictTypeById" parameterType="Long">
       delete from sys_dict_type where dict_id = #{dictId}
    </delete>
    <delete id="deleteDictTypeByIds" parameterType="Long">
       delete from sys_dict_type where dict_id in
       <foreach collection="array" item="dictId" open="(" separator="," close=")">
          #{dictId}
        </foreach>
    </delete>
    <update id="updateDictType" parameterType="SysDictType">
       update sys_dict_type
       <set>
          <if test="dictName != null and dictName != ''">dict_name = #{dictName},</if>
          <if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
          <if test="status != null">status = #{status},</if>
          <if test="remark != null">remark = #{remark},</if>
          <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
          update_time = sysdate()
       </set>
       where dict_id = #{dictId}
   <select id="checkDictTypeUnique" parameterType="String" resultMap="SysDictTypeResult">
      select top(1) dict_id, dict_name, dict_type, status, create_by, create_time, remark
      from sys_dict_type
      where dict_type = #{dictType}
   </select>
   <delete id="deleteDictTypeById" parameterType="Long">
      delete from sys_dict_type where dict_id = #{dictId}
   </delete>
   <delete id="deleteDictTypeByIds" parameterType="Long">
      delete from sys_dict_type where dict_id in
      <foreach collection="array" item="dictId" open="(" separator="," close=")">
         #{dictId}
      </foreach>
   </delete>
   <update id="updateDictType" parameterType="SysDictType">
      update sys_dict_type
      <set>
         <if test="dictName != null and dictName != ''">dict_name = #{dictName},</if>
         <if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
         <if test="status != null">status = #{status},</if>
         <if test="remark != null">remark = #{remark},</if>
         <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
         update_time = getdate()
      </set>
      where dict_id = #{dictId}
   </update>
    <insert id="insertDictType" parameterType="SysDictType">
       insert into sys_dict_type(
          <if test="dictName != null and dictName != ''">dict_name,</if>
          <if test="dictType != null and dictType != ''">dict_type,</if>
          <if test="status != null">status,</if>
          <if test="remark != null and remark != ''">remark,</if>
          <if test="createBy != null and createBy != ''">create_by,</if>
          create_time
       )values(
          <if test="dictName != null and dictName != ''">#{dictName},</if>
          <if test="dictType != null and dictType != ''">#{dictType},</if>
          <if test="status != null">#{status},</if>
          <if test="remark != null and remark != ''">#{remark},</if>
          <if test="createBy != null and createBy != ''">#{createBy},</if>
          sysdate()
       )
   <insert id="insertDictType" parameterType="SysDictType">
      insert into sys_dict_type(
      <if test="dictName != null and dictName != ''">dict_name,</if>
      <if test="dictType != null and dictType != ''">dict_type,</if>
      <if test="status != null">status,</if>
      <if test="remark != null and remark != ''">remark,</if>
      <if test="createBy != null and createBy != ''">create_by,</if>
      create_time
      )values(
      <if test="dictName != null and dictName != ''">#{dictName},</if>
      <if test="dictType != null and dictType != ''">#{dictType},</if>
      <if test="status != null">#{status},</if>
      <if test="remark != null and remark != ''">#{remark},</if>
      <if test="createBy != null and createBy != ''">#{createBy},</if>
      getdate()
      )
   </insert>
</mapper>