灌溉记录的逻辑实现
This commit is contained in:
@ -0,0 +1,154 @@
|
||||
<?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.fastbee.rechargecard.mapper.UserIrrigationRecordMapper">
|
||||
|
||||
<resultMap type="UserIrrigationRecord" id="UserIrrigationRecordResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="deviceNumber" column="device_number" />
|
||||
<result property="projectId" column="project_id" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="cardNumber" column="card_number" />
|
||||
<result property="areaCode" column="area_code" />
|
||||
<result property="curFlow" column="cur_flow" />
|
||||
<result property="curEle" column="cur_ele" />
|
||||
<result property="balance" column="balance" />
|
||||
<result property="startTime" column="start_time" />
|
||||
<result property="endTime" column="end_time" />
|
||||
<result property="duration" column="duration" />
|
||||
<result property="unit" column="unit" />
|
||||
<result property="lastTime" column="last_time" />
|
||||
<result property="status" column="status" />
|
||||
<result property="remarks" column="remarks" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectUserIrrigationRecordVo">
|
||||
select id, user_id, device_number, project_id, dept_id, card_number, area_code, cur_flow, cur_ele, balance, start_time, end_time, duration, unit, last_time, status, remarks, create_time, update_time, create_by, update_by from user_irrigation_record
|
||||
</sql>
|
||||
|
||||
<select id="selectUserIrrigationRecordList" parameterType="UserIrrigationRecord" resultMap="UserIrrigationRecordResult">
|
||||
<include refid="selectUserIrrigationRecordVo"/>
|
||||
<where>
|
||||
<if test="userId != null "> and user_id = #{userId}</if>
|
||||
<if test="deviceNumber != null and deviceNumber != ''"> and device_number = #{deviceNumber}</if>
|
||||
<if test="projectId != null "> and project_id = #{projectId}</if>
|
||||
<if test="deptId != null "> and dept_id = #{deptId}</if>
|
||||
<if test="cardNumber != null and cardNumber != ''"> and card_number = #{cardNumber}</if>
|
||||
<if test="areaCode != null and areaCode != ''"> and area_code = #{areaCode}</if>
|
||||
<if test="curFlow != null "> and cur_flow = #{curFlow}</if>
|
||||
<if test="curEle != null "> and cur_ele = #{curEle}</if>
|
||||
<if test="balance != null "> and balance = #{balance}</if>
|
||||
<if test="startTime != null "> and start_time = #{startTime}</if>
|
||||
<if test="endTime != null "> and end_time = #{endTime}</if>
|
||||
<if test="duration != null "> and duration = #{duration}</if>
|
||||
<if test="unit != null "> and unit = #{unit}</if>
|
||||
<if test="lastTime != null "> and last_time = #{lastTime}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
<if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectUserIrrigationRecordListBycardNumber" parameterType="String" resultMap="UserIrrigationRecordResult">
|
||||
<include refid="selectUserIrrigationRecordVo"/>
|
||||
<where>
|
||||
card_number=#{cardNumber}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectUserIrrigationRecordById" parameterType="Long" resultMap="UserIrrigationRecordResult">
|
||||
<include refid="selectUserIrrigationRecordVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertUserIrrigationRecord" parameterType="UserIrrigationRecord" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into user_irrigation_record
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="deviceNumber != null">device_number,</if>
|
||||
<if test="projectId != null">project_id,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
<if test="cardNumber != null">card_number,</if>
|
||||
<if test="areaCode != null">area_code,</if>
|
||||
<if test="curFlow != null">cur_flow,</if>
|
||||
<if test="curEle != null">cur_ele,</if>
|
||||
<if test="balance != null">balance,</if>
|
||||
<if test="startTime != null">start_time,</if>
|
||||
<if test="endTime != null">end_time,</if>
|
||||
<if test="duration != null">duration,</if>
|
||||
<if test="unit != null">unit,</if>
|
||||
<if test="lastTime != null">last_time,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="remarks != null">remarks,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="deviceNumber != null">#{deviceNumber},</if>
|
||||
<if test="projectId != null">#{projectId},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
<if test="cardNumber != null">#{cardNumber},</if>
|
||||
<if test="areaCode != null">#{areaCode},</if>
|
||||
<if test="curFlow != null">#{curFlow},</if>
|
||||
<if test="curEle != null">#{curEle},</if>
|
||||
<if test="balance != null">#{balance},</if>
|
||||
<if test="startTime != null">#{startTime},</if>
|
||||
<if test="endTime != null">#{endTime},</if>
|
||||
<if test="duration != null">#{duration},</if>
|
||||
<if test="unit != null">#{unit},</if>
|
||||
<if test="lastTime != null">#{lastTime},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="remarks != null">#{remarks},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateUserIrrigationRecord" parameterType="UserIrrigationRecord">
|
||||
update user_irrigation_record
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
<if test="deviceNumber != null">device_number = #{deviceNumber},</if>
|
||||
<if test="projectId != null">project_id = #{projectId},</if>
|
||||
<if test="deptId != null">dept_id = #{deptId},</if>
|
||||
<if test="cardNumber != null">card_number = #{cardNumber},</if>
|
||||
<if test="areaCode != null">area_code = #{areaCode},</if>
|
||||
<if test="curFlow != null">cur_flow = #{curFlow},</if>
|
||||
<if test="curEle != null">cur_ele = #{curEle},</if>
|
||||
<if test="balance != null">balance = #{balance},</if>
|
||||
<if test="startTime != null">start_time = #{startTime},</if>
|
||||
<if test="endTime != null">end_time = #{endTime},</if>
|
||||
<if test="duration != null">duration = #{duration},</if>
|
||||
<if test="unit != null">unit = #{unit},</if>
|
||||
<if test="lastTime != null">last_time = #{lastTime},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="remarks != null">remarks = #{remarks},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteUserIrrigationRecordById" parameterType="Long">
|
||||
delete from user_irrigation_record where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteUserIrrigationRecordByIds" parameterType="String">
|
||||
delete from user_irrigation_record where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Reference in New Issue
Block a user