package com.kaishengit.dto;
import lombok.Data;
/**
* Created by wgs on 2017/2/24.
*/
@Data
public class EChartsResult {
public static final String TYPE_IN = "收入";
public static final String TYPE_OUT = "支出";
private String name;
private Float value;
public EChartsResult() {
}
public EChartsResult(String name, Float value) {
this.name = name;
this.value = value;
}
}
<select id="findByQuery" resultType="com.kaishengit.dto.EChartsResult">
SELECT tf.module AS "name" ,SUM(tf.money)AS "value" FROM t_finance AS tf
WHERE tf.create_date LIKE CONCAT('%',#{month},'%') GROUP BY tf.module
</select>
resultMap
public class Dept {
private Integer id;
private String deptname;
private List<Employee> employeeList;
// getXxx setXxx
}
public class Employee {
private Integer id;
private String empname;
private Integer deptid;
private Dept dept;
}
<select id="findById" parameterType="int" resultType="Employee">
SELECT employee.id,empname,deptid,
dept.id AS 'dept.id',deptname AS 'dept.deptname'
FROM
employee
INNER JOIN dept ON employee.deptid = dept.id
WHERE
employee.id = #{id}
</select>