<?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.boco.nbd.wios.flow.mapper.def.PlanTaskMapper"> <resultMap id="BaseResultMap" type="com.boco.nbd.wios.flow.entity.po.PlanTaskPO"> <result property="year" column="year" jdbcType="VARCHAR"/> <result property="oemName" column="oem_name" jdbcType="VARCHAR"/> <result property="janCount" column="jan_count" jdbcType="INTEGER"/> <result property="febCount" column="feb_count" jdbcType="INTEGER"/> <result property="marCount" column="mar_count" jdbcType="INTEGER"/> <result property="aprCount" column="apr_count" jdbcType="INTEGER"/> <result property="mayCount" column="may_count" jdbcType="INTEGER"/> <result property="junCount" column="jun_count" jdbcType="INTEGER"/> <result property="julCount" column="jul_count" jdbcType="INTEGER"/> <result property="augCount" column="aug_count" jdbcType="INTEGER"/> <result property="sepCount" column="sep_count" jdbcType="INTEGER"/> <result property="octCount" column="oct_count" jdbcType="INTEGER"/> <result property="novCount" column="nov_count" jdbcType="INTEGER"/> <result property="decCount" column="dec_count" jdbcType="INTEGER"/> <result property="createUser" column="create_user" jdbcType="VARCHAR"/> </resultMap> <sql id="Base_Column_List"> year,oem_name,jan_count, feb_count,mar_count,apr_count, may_count,jun_count,jul_count, aug_count,sep_count,oct_count, nov_count,dec_count,create_user </sql> <select id="selectByYearAndOemName" resultType="com.boco.nbd.wios.flow.entity.po.PlanTaskPO"> select year, sum(jan_count) as jan_count, sum(feb_count) as feb_count, sum(mar_count) as mar_count, sum(apr_count) as apr_count, sum(may_count) as may_count, sum(jun_count) as jun_count, sum(jul_count) as jul_count, sum(aug_count) as aug_count, sum(sep_count) as sep_count, sum(oct_count) as oct_count, sum(nov_count) as nov_count, sum(dec_count) as dec_count from t_plan_task where year=#{year} <if test="oemName != null and oemName != ''"> and oem_name=#{oemName} </if> GROUP BY year </select> </mapper>