123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- <?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.DailyRecordMaintainDao">
- <resultMap type="cn.ourwill.module.house.entity.daily.DailyRecordMaintain" id="BaseResultMap">
- <result column="id" property="id"/>
- <result column="check_date" property="checkDate"/>
- <!-- <result column="type" property="type"/>-->
- <result column="project" property="project"/>
- <result column="problem" property="problem"/>
- <!-- <result column="opinion" property="opinion"/>
- <result column="bosshead" property="bosshead"/>
- <result column="maintain_start_date" property="maintainStartDate"/>
- <result column="maintain_end_date" property="maintainEndDate"/>-->
- <result column="result" property="result"/>
- <result column="remark" property="remark"/>
- <!-- <result column="check_person" property="checkPerson"/>-->
- <result column="house_id" property="houseId"/>
- <result column="uuid" property="uuid"/>
- <result column="c_id" property="cId"/>
- <result column="c_time" property="cTime" />
- <result column="u_id" property="uId"/>
- <result column="u_time" property="uTime" />
- <!--<result column="finish_date" property="finishDate"/>-->
- </resultMap>
- <sql id="houseColumns">
- id,check_date,project,problem,result,remark,house_id,uuid,c_id,c_time,u_id,u_time
- </sql>
- <sql id="houseColumns_old">
- id,check_date,type,project,problem,opinion,bosshead,maintain_start_date,maintain_end_date,result,remark,check_person,house_id,finish_date
- </sql>
- <insert id="insert" parameterType="cn.ourwill.module.house.entity.daily.DailyRecordMaintain">
- INSERT INTO daily_record_maintain( <include refid="houseColumns"/>)
- VALUES (
- #{id},#{checkDate},#{project},#{problem},#{result},#{remark},#{houseId},#{uuid},#{cId},#{cTime},#{uId},#{uTime}
- )
- </insert>
- <!-- <insert id="insert" parameterType="cn.ourwill.module.house.entity.daily.DailyRecordMaintain">
- INSERT INTO daily_record_maintain( <include refid="houseColumns"/>)
- VALUES (
- #{id},#{checkDate},#{type},#{project},#{problem},#{opinion},#{bosshead},#{maintainStartDate},#{maintainEndDate},#{result},#{remark},#{checkPerson},#{houseId},#{finishDate}
- )
- </insert>-->
- <!-- 查询检测记录 -->
- <select id="findList" parameterType="cn.ourwill.module.house.entity.daily.DailyRecordMaintain" resultMap="BaseResultMap">
- SELECT <include refid="houseColumns"/>
- FROM daily_record_maintain WHERE 1 = 1
- <if test="maintainStartDate != null and maintainEndDate != null">
- AND check_date BETWEEN #{maintainStartDate} AND #{maintainEndDate}
- </if>
- <!--<if test="type != null">
- AND type = #{type}
- </if>-->
- <if test="houseId != null">
- and house_id = #{houseId}
- </if>
- <if test="cTime !=null">
- and c_time like CONCAT('%',#{cTime},'%')
- </if>
- order by id desc
- </select>
- <!-- 根据id查询 -->
- <select id="getById" parameterType="long" resultType="cn.ourwill.module.house.entity.daily.DailyRecordMaintain">
- SELECT <include refid="houseColumns"/>
- FROM daily_record_maintain
- WHERE id = #{value}
- </select>
- <!-- 根据houseid查询 -->
- <select id="getByHouseId" parameterType="long" resultMap="BaseResultMap">
- SELECT DISTINCT(project) FROM daily_record_maintain
- WHERE house_id = #{value}
- </select>
- <select id="findAllList" resultMap="BaseResultMap">
- SELECT <include refid="houseColumns"/>
- FROM daily_record_maintain
- order by id desc
- </select>
- <update id="update" parameterType="cn.ourwill.module.house.entity.daily.DailyRecordMaintain">
- UPDATE daily_record_maintain
- <set>
- <if test="checkDate != null">
- check_date = #{checkDate},
- </if>
- <if test="type != null">
- type = #{type},
- </if>
- <if test="project != null">
- project = #{project},
- </if>
- <if test="problem != null">
- problem = #{problem},
- </if>
- <if test="opinion != null">
- opinion = #{opinion},
- </if>
- <if test="bosshead != null">
- bosshead = #{bosshead},
- </if>
- <if test="maintainStartDate != null">
- maintain_start_date = #{maintainStartDate},
- </if>
- <if test="maintainEndDate != null">
- maintain_end_date = #{maintainEndDate},
- </if>
- <if test="result != null">
- result = #{result},
- </if>
- <if test="remark != null">
- remark = #{remark},
- </if>
- <if test="checkPerson != null">
- check_person = #{checkPerson},
- </if>
- <if test="finishDate != null">
- finish_date = #{finishDate}
- </if>
- </set>
- WHERE id = #{id}
- </update>
- <update id="updateByUUID" parameterType="cn.ourwill.module.house.entity.daily.DailyRecordMaintain">
- UPDATE daily_record_maintain
- <set>
- <if test="checkDate != null">
- check_date = #{checkDate},
- </if>
- <if test="type != null">
- type = #{type},
- </if>
- <if test="project != null">
- project = #{project},
- </if>
- <if test="problem != null">
- problem = #{problem},
- </if>
- <if test="opinion != null">
- opinion = #{opinion},
- </if>
- <if test="bosshead != null">
- bosshead = #{bosshead},
- </if>
- <if test="maintainStartDate != null">
- maintain_start_date = #{maintainStartDate},
- </if>
- <if test="maintainEndDate != null">
- maintain_end_date = #{maintainEndDate},
- </if>
- <if test="result != null">
- result = #{result},
- </if>
- <if test="remark != null">
- remark = #{remark},
- </if>
- <if test="checkPerson != null">
- check_person = #{checkPerson},
- </if>
- <if test="finishDate != null">
- finish_date = #{finishDate}
- </if>
- </set>
- WHERE uuid = #{uuid}
- </update>
- <!-- 删除维修记录 -->
- <delete id="deleteById" parameterType="long">
- DELETE FROM daily_record_maintain WHERE id = #{value}
- </delete>
- <!-- 查询检查类别 -->
- <select id="getType" resultType="string">
- SELECT DISTINCT type FROM daily_record_maintain
- </select>
- <select id="findByHouseId" resultMap="BaseResultMap">
- SELECT *
- FROM daily_record_maintain a
- where house_id=#{houseId}
- <if test="cTime != null">
- AND c_time <![CDATA[ <= ]]> #{cTime}
- </if>
- </select>
- <select id="getByUuid" resultMap="BaseResultMap">
- SELECT *
- FROM daily_record_maintain a
- where uuid=#{uuid}
- </select>
- <delete id="deleteByHouseId">
- DELETE FROM daily_record_maintain
- WHERE house_id = #{houseId}
- <if test="cTime != null">
- AND c_time <![CDATA[ <= ]]> #{cTime}
- </if>
- </delete>
- </mapper>
|