| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?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.management.platform.mapper.DeviceCostMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.management.platform.entity.DeviceCost">
- <id column="id" property="id" />
- <result column="device_id" property="deviceId" />
- <result column="month_cost" property="monthCost" />
- <result column="ymonth" property="ymonth" />
- </resultMap>
- <!-- 通用查询结果列 -->
- <sql id="Base_Column_List">
- id, device_id, month_cost, ymonth
- </sql>
- <select id="getDeviceCostList" resultType="java.util.HashMap">
- select d.device_code deviceCode,d.device_name deviceName,
- d.device_model deviceModel, d.manufacturer,dc.ymonth ,dc.id,dc.month_cost monthCost
- from device d
- inner JOIN device_cost dc on d.id=dc.device_id
- <where>
- <if test="companyId !=null">
- and d.company_id=#{companyId}
- </if>
- <if test="deviceCost.deviceCode!=null and deviceCost.deviceCode!='' ">
- and d.device_code like CONCAT('%', #{deviceCost.deviceCode}, '%')
- </if>
- <if test="deviceCost.ymonth!=null and deviceCost.ymonth!='' ">
- and dc.ymonth= #{deviceCost.ymonth}
- </if>
- </where>
- <if test="deviceCost.pageIndex!=null and deviceCost.pageSize!=null">
- limit #{deviceCost.pageIndex},#{deviceCost.pageSize}
- </if>
- </select>
- <select id="getDeviceCostTotal" resultType="java.lang.Integer">
- select count(*) total
- from device d
- inner JOIN device_cost dc on d.id=dc.device_id
- <where>
- <if test="companyId !=null">
- and d.company_id=#{companyId}
- </if>
- <if test="deviceCost.deviceCode!=null and deviceCost.deviceCode!='' ">
- and d.device_code like CONCAT('%', #{deviceCost.deviceCode}, '%')
- </if>
- <if test="deviceCost.ymonth!=null and deviceCost.ymonth!='' ">
- and dc.ymonth= #{deviceCost.ymonth}
- </if>
- </where>
- </select>
- </mapper>
|