SystemNoticeMapper.xml 7.4 KB
Newer Older
苗卫卫 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
<?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.boco.nbd.wios.manage.mapper.def.SystemNoticeMapper">

  <resultMap id="BaseResultMap" type="com.boco.nbd.wios.manage.entity.bo.SystemNotice">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="title" jdbcType="VARCHAR" property="title" />
    <result column="type" jdbcType="INTEGER" property="type" />
    <result column="content" jdbcType="VARCHAR" property="content" />
    <result column="status" jdbcType="INTEGER" property="status" />
    <result column="create_account" jdbcType="VARCHAR" property="createAccount" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="modify_account" jdbcType="VARCHAR" property="modifyAccount" />
    <result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime" />
    <result column="publish_time" jdbcType="TIMESTAMP" property="publishTime" />
    <result column="notice_annex" jdbcType="VARCHAR" property="noticeAnnex" />
    <result column="file_annex" jdbcType="VARCHAR" property="fileAnnex" />
    <result column="display_from" jdbcType="TIMESTAMP" property="displayFrom" />
    <result column="display_end" jdbcType="TIMESTAMP" property="displayEnd" />
  </resultMap>


  <sql id="Base_Column_List">
  tsn.id,
  tsn.title,
  tsn.type,
  tsn.content,
  tsn.status,
  tsn.create_account,
  tsn.create_time,
  tsn.modify_account,
  tsn.modify_time,
  tsn.publish_time,
  tsn.notice_annex,
  tsn.file_annex,
  tsn.display_from,
  tsn.display_end
</sql>

<sql id="Base_Column_ForList">
  tsn.id,
  tsn.title,
  tsn.type,
  tsn.status,
  tsn.create_account,
  tsn.create_time,
  tsn.modify_account,
  tsn.modify_time,
  tsn.publish_time,
  tsn.notice_annex,
  tsn.file_annex,
  tsn.display_from,
  tsn.display_end
</sql>


  <delete id="delete" parameterType="java.lang.String">
  delete from t_system_notice
  where id = #{id,jdbcType=INTEGER}
</delete>


  <insert id="insert" parameterType="com.boco.nbd.wios.manage.entity.bo.SystemNotice">
  insert into t_system_notice (id, title, type,
    content, status, create_account,
    create_time, modify_account, modify_time,
    publish_time, notice_annex, file_annex,
    display_from, display_end)
  values (#{id,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER},
    #{content,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{createAccount,jdbcType=VARCHAR},
    #{createTime,jdbcType=TIMESTAMP}, #{modifyAccount,jdbcType=VARCHAR}, #{modifyTime,jdbcType=TIMESTAMP},
    #{publishTime,jdbcType=TIMESTAMP}, #{noticeAnnex,jdbcType=VARCHAR}, #{fileAnnex,jdbcType=VARCHAR},
    #{displayFrom,jdbcType=TIMESTAMP}, #{displayEnd,jdbcType=TIMESTAMP})
</insert>





  <update id="updateNotice" parameterType="com.boco.nbd.wios.manage.entity.bo.SystemNoticeBo">
    update t_system_notice
    <set>
      <if test="title != null">
        title = #{title,jdbcType=VARCHAR},
      </if>
      <if test="type != null">
        type = #{type,jdbcType=INTEGER},
      </if>
      <if test="content != null">
        content = #{content,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        status = #{status,jdbcType=INTEGER},
      </if>
      <if test="createAccount != null">
        create_account = #{createAccount,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="modifyAccount != null">
        modify_account = #{modifyAccount,jdbcType=VARCHAR},
      </if>
      <if test="modifyTime != null">
        modify_time = #{modifyTime,jdbcType=TIMESTAMP},
      </if>
      <if test="publishTime != null">
        publish_time = #{publishTime,jdbcType=TIMESTAMP},
      </if>
      <if test="noticeAnnex != null">
        notice_annex = #{noticeAnnex,jdbcType=VARCHAR},
      </if>
      <if test="fileAnnex != null">
        file_annex = #{fileAnnex,jdbcType=VARCHAR},
      </if>
      <if test="displayFrom != null">
        display_from = #{displayFrom,jdbcType=TIMESTAMP},
      </if>
      <if test="displayEnd != null">
        display_end = #{displayEnd,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>




  <select id="selectById" parameterType="java.lang.String" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from  t_system_notice tsn
    where tsn.id = #{id,jdbcType=INTEGER}
  </select>

  <select id="getList" parameterType="com.boco.nbd.wios.manage.entity.bo.SystemNoticeBo" resultType="com.boco.nbd.wios.manage.entity.bo.SystemNoticeVo">
    select
    <include refid="Base_Column_ForList" />
    from  t_system_notice tsn
    <include refid="findPageWithWhere" />
    order by tsn.modify_time desc
  </select>

  <select id="getDetail" parameterType="com.boco.nbd.wios.manage.entity.bo.SystemNoticeBo" resultType="com.boco.nbd.wios.manage.entity.bo.SystemNoticeVo">
    select
    <include refid="Base_Column_List" />
    ,tu1.name createAccountName
    ,tu2.name modifyAccountName
    from  t_system_notice tsn
    left join t_user tu1 on  tsn.create_account = tu1.account
    left join t_user tu2 on  tsn.modify_account = tu2.account
    where tsn.id = #{id}
  </select>


  <sql id="findPageWithWhere">
    <where> 1=1
        and tsn.status != 0
      <if test="allList != null and allList == 0" >
        and tsn.status = 1
      </if>
      <if test="id != null and id != ''" >
        and tsn.id = #{id,jdbcType=INTEGER}
      </if>
      <if test="title != null and title != ''" >
        and tsn.title = #{title,jdbcType=VARCHAR}
      </if>
      <if test="type != null" >
        and tsn.type = #{type,jdbcType=INTEGER}
      </if>
      <if test="content != null and content != ''" >
        and tsn.content = #{content,jdbcType=VARCHAR}
      </if>
      <if test="createAccount != null and createAccount != ''" >
        and tsn.create_account = #{createAccount,jdbcType=VARCHAR}
      </if>
      <if test="createTime != null" >
        and tsn.create_time = #{createTime,jdbcType=TIMESTAMP}
      </if>
      <if test="modifyAccount != null and modifyAccount != ''" >
        and tsn.modify_account = #{modifyAccount,jdbcType=VARCHAR}
      </if>
      <if test="modifyTime != null" >
        and tsn.modify_time = #{modifyTime,jdbcType=TIMESTAMP}
      </if>
      <if test="publishTime != null" >
        and tsn.publish_time = #{publishTime,jdbcType=TIMESTAMP}
      </if>
      <if test="noticeAnnex != null and noticeAnnex != ''" >
        and tsn.notice_annex = #{noticeAnnex,jdbcType=VARCHAR}
      </if>
      <if test="fileAnnex != null and fileAnnex != ''" >
        and tsn.file_annex = #{fileAnnex,jdbcType=VARCHAR}
      </if>
      <if test="allList != null and allList == 0 and type ==1">
        <![CDATA[   and DATE_FORMAT(tsn.display_from, '%Y-%m-%d')<=  DATE_FORMAT(#{nowDate}, '%Y-%m-%d')   ]]>
      </if>
      <if test="allList != null and allList == 0 and type ==1">
        <![CDATA[   and DATE_FORMAT(tsn.display_end, '%Y-%m-%d')>=  DATE_FORMAT(#{nowDate}, '%Y-%m-%d')   ]]>
      </if>
    </where>
  </sql>


<!--  <select id="findPageWithResult" parameterType="com.starcharge.wios.dto.SystemNoticeDTO" resultMap="BaseResultMap">-->
<!--    select-->
<!--    <include refid="Base_Column_List" />-->
<!--    from  t_system_notice-->
<!--    <include refid="findPageWithWhere" />-->
<!--    limit #{start},#{pageSize}-->
<!--  </select>-->




</mapper>