123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259 |
- <?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="cn.ourwill.module.house.dao.daily.CheckPointDao">
- <resultMap type="cn.ourwill.module.house.entity.daily.CheckPoint" id="baseMap">
- <result column="ID" property="id"/>
- <result column="checkpoint_name" property="checkpointName"/>
- <result column="checkpoint_code" property="checkpointCode"/>
- <result column="checkpoint_desc" property="checkpointDesc"/>
- <result column="checkpoint_grain_id" property="checkpointGrainId"/>
- <result column="checkpoint_grain_name" property="checkpointGrainName"/>
- <result column="checkpoint_post_id" property="checkpointPostId"/>
- <result column="checkpoint_post_name" property="checkpointPostName"/>
- </resultMap>
- <sql id="columns">
- a.ID ,
- a.checkpoint_name ,
- a.checkpoint_code ,
- a.checkpoint_desc ,
- a.checkpoint_grain_id ,
- a.checkpoint_grain_name ,
- a.checkpoint_post_id ,
- a.checkpoint_post_name
- </sql>
- <sql id="joinCols">
- </sql>
- <select id="get" resultMap="baseMap">
- SELECT
- <include refid="columns"/>
- FROM checkpoint a
- <include refid="joinCols"/>
- WHERE a.id = #{id}
- </select>
- <select id="findList" resultMap="baseMap">
- SELECT
- <include refid="columns"/>
- FROM checkpoint a
- LEFT JOIN sys_grain sg on sg.id=a.checkpoint_grain_id
- <include refid="joinCols"/>
- <where>
- <if test="id !=null">
- and a.ID = #{id}
- </if>
- <if test="checkpointName !=null">
- and a.checkpoint_name like CONCAT('%',#{checkpointName},'%')
- </if>
- <if test="checkpointCode !=null">
- and a.checkpoint_code = #{checkpointCode}
- </if>
- <if test="checkpointDesc !=null">
- and a.checkpoint_desc like CONCAT('%',#{checkpointDesc},'%')
- </if>
- <if test="checkpointGrainId !=null">
- and a.checkpoint_grain_id = #{checkpointGrainId}
- </if>
- <if test="checkpointGrainName !=null">
- and a.checkpoint_grain_name = #{checkpointGrainName}
- </if>
- <if test="checkpointPostId !=null">
- and a.checkpoint_post_id = #{checkpointPostId}
- </if>
- <if test="checkpointPostName !=null">
- and a.checkpoint_post_name = #{checkpointPostName}
- </if>
- <if test="cityId !=null">
- and sg.parentId = #{cityId}
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
- <select id="findBkList" resultMap="baseMap">
- SELECT
- <include refid="columns"/>
- FROM checkpoint a
- LEFT JOIN sys_grain sg on sg.id=a.checkpoint_grain_id
- <include refid="joinCols"/>
- <where>
- <if test="id !=null">
- and a.ID = #{id}
- </if>
- <if test="checkpointName !=null">
- and a.checkpoint_name like CONCAT('%',#{checkpointName},'%')
- </if>
- <if test="checkpointCode !=null">
- and a.checkpoint_code = #{checkpointCode}
- </if>
- <if test="checkpointDesc !=null">
- and a.checkpoint_desc like CONCAT('%',#{checkpointDesc},'%')
- </if>
- <if test="checkpointGrainId !=null">
- and a.checkpoint_grain_id in (SELECT id FROM sys_grain a WHERE parentId = #{checkpointGrainId} OR parentId IN (SELECT id FROM sys_grain WHERE parentId = #{checkpointGrainId} AND NAME LIKE '%库外储粮%'))
- </if>
- <if test="checkpointGrainName !=null">
- and a.checkpoint_grain_name = #{checkpointGrainName}
- </if>
- <if test="checkpointPostId !=null">
- and a.checkpoint_post_id = #{checkpointPostId}
- </if>
- <if test="checkpointPostName !=null">
- and a.checkpoint_post_name = #{checkpointPostName}
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
- <select id="findAllList" resultMap="baseMap">
- SELECT
- <include refid="columns"/>
- FROM checkpoint a
- <include refid="joinCols"/>
- <where>
- <if test="id !=null">
- and ID = #{id}
- </if>
- <if test="checkpointName !=null">
- and checkpoint_name like CONCAT('%',#{checkpointName},'%')
- </if>
- <if test="checkpointCode !=null">
- and checkpoint_code = #{checkpointCode}
- </if>
- <if test="checkpointDesc !=null">
- and checkpoint_desc like CONCAT('%',#{checkpointDesc},'%')
- </if>
- <if test="checkpointGrainId !=null">
- and checkpoint_grain_id = #{checkpointGrainId}
- </if>
- <if test="checkpointGrainName !=null">
- and checkpoint_grain_name = #{checkpointGrainName}
- </if>
- <if test="checkpointPostId !=null">
- and checkpoint_post_id = #{checkpointPostId}
- </if>
- <if test="checkpointPostName !=null">
- and checkpoint_post_name = #{checkpointPostName}
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
- <insert id="insert" keyColumn="ID" keyProperty="id" useGeneratedKeys="true"
- parameterType="cn.ourwill.module.house.entity.daily.CheckPoint">
- INSERT INTO checkpoint
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id !=null">
- ID,
- </if>
- <if test="checkpointName !=null">
- checkpoint_name,
- </if>
- <if test="checkpointCode !=null">
- checkpoint_code,
- </if>
- <if test="checkpointDesc !=null">
- checkpoint_desc,
- </if>
- <if test="checkpointGrainId !=null">
- checkpoint_grain_id,
- </if>
- <if test="checkpointGrainName !=null">
- checkpoint_grain_name,
- </if>
- <if test="checkpointPostId !=null">
- checkpoint_post_id,
- </if>
- <if test="checkpointPostName !=null">
- checkpoint_post_name
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id !=null">
- #{id},
- </if>
- <if test="checkpointName !=null">
- #{checkpointName},
- </if>
- <if test="checkpointCode !=null">
- #{checkpointCode},
- </if>
- <if test="checkpointDesc !=null">
- #{checkpointDesc},
- </if>
- <if test="checkpointGrainId !=null">
- #{checkpointGrainId},
- </if>
- <if test="checkpointGrainName !=null">
- #{checkpointGrainName},
- </if>
- <if test="checkpointPostId !=null">
- #{checkpointPostId},
- </if>
- <if test="checkpointPostName !=null">
- #{checkpointPostName}
- </if>
- </trim>
- </insert>
- <update id="update" parameterType="cn.ourwill.module.house.entity.daily.CheckPoint">
- UPDATE checkpoint <set>
- <if test="id != null">
- ID= #{id} ,
- </if>
- <if test="checkpointName != null">
- checkpoint_name= #{checkpointName} ,
- </if>
- <if test="checkpointCode != null">
- checkpoint_code= #{checkpointCode} ,
- </if>
- <if test="checkpointDesc !=null">
- checkpoint_desc = #{checkpointDesc} ,
- </if>
- <if test="checkpointGrainId != null">
- checkpoint_grain_id= #{checkpointGrainId} ,
- </if>
- <if test="checkpointGrainName != null">
- checkpoint_grain_name= #{checkpointGrainName} ,
- </if>
- <if test="checkpointPostId != null">
- checkpoint_post_id= #{checkpointPostId} ,
- </if>
- <if test="checkpointPostName != null">
- checkpoint_post_name= #{checkpointPostName} ,
- </if>
- </set>
- WHERE id = #{id}
- </update>
- <delete id="deleteById" parameterType="java.lang.Long">
- DELETE FROM checkpoint WHERE ID = #{id}
- </delete>
- <delete id="deleteByIds" parameterType="java.util.List">
- DELETE FROM checkpoint WHERE ID IN
- <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </delete>
- </mapper>
|