85 lines
3.3 KiB
XML
85 lines
3.3 KiB
XML
<?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.unizk.mapper.DeviceMapper">
|
|
|
|
<resultMap id="BaseResultMap" type="cn.unizk.entity.po.Device">
|
|
<result column="device_id" property="deviceId" jdbcType="VARCHAR" />
|
|
<result column="muid" property="muid" jdbcType="VARCHAR" />
|
|
<result column="store_id" property="storeId" jdbcType="INTEGER" />
|
|
<result column="agent_id" property="agentId" jdbcType="INTEGER" />
|
|
<result column="user_id" property="userId" jdbcType="INTEGER" />
|
|
<result column="status" property="status" jdbcType="VARCHAR" />
|
|
<result column="affiliated_with" property="affiliatedWith" jdbcType="VARCHAR" />
|
|
<result column="payment_method" property="paymentMethod" jdbcType="INTEGER" />
|
|
<result column="expire_time" property="expireTime" jdbcType="VARCHAR" />
|
|
<result column="warehousing_time" property="warehousingTime" jdbcType="INTEGER" />
|
|
<result column="outbound_time" property="outboundTime" jdbcType="INTEGER" />
|
|
<result column="balance" property="balance" jdbcType="DECIMAL" />
|
|
<result column="surplus" property="surplus" jdbcType="INTEGER" />
|
|
<result column="lo" property="lo" jdbcType="VARCHAR" />
|
|
<result column="la" property="la" jdbcType="VARCHAR" />
|
|
</resultMap>
|
|
|
|
<update id="updateStatus" parameterType="string">
|
|
update device set status = #{status} where device_id = #{deviceId}
|
|
</update>
|
|
|
|
<update id="reduceDay">
|
|
update device set surplus = surplus - 1 where payment_method = 1 and surplus > 0
|
|
</update>
|
|
|
|
<select id="selectCurrentYearDeviceCount" resultType="java.lang.Integer">
|
|
SELECT
|
|
count(*)
|
|
FROM
|
|
device
|
|
WHERE
|
|
YEAR ( warehousing_time ) = YEAR (
|
|
CURDATE())
|
|
</select>
|
|
|
|
<select id="selectCurrentYearDevice" resultMap="BaseResultMap">
|
|
SELECT
|
|
*
|
|
FROM
|
|
device
|
|
WHERE
|
|
SUBSTR( device_id, 6, 2 ) = #{year}
|
|
</select>
|
|
|
|
|
|
<select id="selectAbnormalDevice" resultMap="BaseResultMap">
|
|
SELECT device_id
|
|
FROM device
|
|
WHERE last_run_time < DATE_SUB(NOW(), INTERVAL 1 MINUTE ) and operating_status not in(1,2);
|
|
</select>
|
|
|
|
<update id="updateAbnormalDevice">
|
|
update device set operating_status = 2 where last_run_time < DATE_SUB(NOW(), INTERVAL 1 MINUTE ) and operating_status not in(1,2);
|
|
</update>
|
|
|
|
<update id="updateFreeCount">
|
|
update device set free_count = free_count -1 where free_count > 0 and last_run_time < DATE_SUB(NOW(), INTERVAL 1 MINUTE ) and operating_status not in(1,2);
|
|
</update>
|
|
|
|
<update id="updateTreatDevice">
|
|
UPDATE user
|
|
SET treat_status = 0
|
|
WHERE create_time < NOW() - INTERVAL 30 MINUTE;
|
|
</update>
|
|
|
|
|
|
<update id="updateDeviceInfo" parameterType="cn.unizk.entity.po.Device">
|
|
update device set cf = #{dv.cf},wm = #{dv.wm},hw = #{dv.hw},sw = #{dv.sw},iccid = #{dv.iccid} ,cr = #{dv.cr},
|
|
operating_status = #{dv.operatingStatus},last_run_time = #{dv.lastRunTime}
|
|
where device_id = #{dv.deviceId}
|
|
</update>
|
|
|
|
<update id="modifyDeviceId">
|
|
update device set device_id = #{ndeviceId} where device_id = #{odeviceId}
|
|
</update>
|
|
|
|
</mapper>
|