Open songhuiqing88 opened 7 years ago
覆盖dao查询xml。org.gtiles.components.gtclasses.classstu.extension.IClassStuExtensionDao.xml,在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="org.gtiles.components.gtclasses.classstu.extension.IClassStuExtensionDao"> <!-- 班级用户扩展结果 --> <resultMap type="org.gtiles.components.gtclasses.classstu.bean.ClassStuBean" id="classStuExt"> <id column="CLASS_STU_ID" jdbcType="VARCHAR" property="classStuId"/> <result column="USER_ID" jdbcType="VARCHAR" property="userId"/> <result column="VERIFY_STATE" jdbcType="INTEGER" property="verifyState"/> <result column="END_SCORE" jdbcType="FLOAT" property="endScore"/> <result column="ENTRY_TIME" jdbcType="TIMESTAMP" property="entryTime"/> <result column="PASS_STATE" jdbcType="INTEGER" property="passState"/> <result column="CLASS_ID" jdbcType="VARCHAR" property="classId"/> <result column="CLASS_ORG_ID" jdbcType="VARCHAR" property="classOrgId"/> <result column="PASS_TIME" jdbcType="TIMESTAMP" property="passTime"/> <result column="CLASS_NAME" jdbcType="VARCHAR" property="className"/> <result column="CLASS_TYPE" jdbcType="VARCHAR" property="classType"/> <result column="SCORE" jdbcType="FLOAT" property="score"/> <result column="ORGANIZATION_ID" jdbcType="VARCHAR" property="organizationId"/> <result column="ORGANIZATION_NAME" jdbcType="VARCHAR" property="organizationName"/> <result column="DUTY" jdbcType="VARCHAR" property="duty"/> <result column="PROFESSIONAL_LEVEL" jdbcType="VARCHAR" property="professionalevel"/> <result column="MOBILE_PHONE" jdbcType="VARCHAR" property="mobilePhone"/> <result column="EMAIL" jdbcType="VARCHAR" property="email"/> <result column="GENDER" jdbcType="INTEGER" property="gender"/> <result column="NAME" jdbcType="VARCHAR" property="name"/> <result column="ID_CARD_NUM" jdbcType="VARCHAR" property="idCardNum"/> </resultMap> <sql id="querylistCols"> t.CLASS_STU_ID, t.USER_ID, t.VERIFY_STATE, t.END_SCORE, t.ENTRY_TIME, t.PASS_STATE, t.CLASS_ID, t.CLASS_ORG_ID, t.PASS_TIME, o.ORGANIZATION_ID, o.ORGANIZATION_NAME, u.DUTY, u.PROFESSIONAL_LEVEL, u.MOBILE_PHONE, u.EMAIL, u.GENDER, u.`NAME`, u.ID_CARD_NUM </sql> <sql id="queryCommand"> <if test="query.queryUserId != null and query.queryUserId!=''"> and t.USER_ID=#{query.queryUserId}</if> <if test="query.queryVerifyState != null"> and t.VERIFY_STATE=#{query.queryVerifyState}</if> <if test="query.queryPassState != null"> and t.PASS_STATE=#{query.queryPassState}</if> <if test="query.queryClassId != null"> and t.CLASS_ID=#{query.queryClassId}</if> <if test="query.queryClassOrgId != null"> and t.CLASS_ORG_ID=#{query.queryClassOrgId}</if> <if test="query.queryOrgIdList != null and query.queryOrgIdList.size>0"> and t.CLASS_ORG_ID in ( select CLASS_ORG_ID from GT_CLASS_ORGANATION where ORG_ID in <foreach collection="query.queryOrgIdList" index="index" item="orgId" open="(" separator="," close=")"> #{orgId} </foreach> ) </if> <if test="query.queryName!= null"> <bind name="user_name" value="'%'+query.queryName+'%'" /> and u.NAME like #{user_name} </if> <if test="query.queryOrganizationName!= null"> <bind name="org_name" value="'%'+query.queryOrganizationName+'%'" /> and o.ORGANIZATION_NAME like #{org_name} </if> <if test="query.queryDuty!= null"> <bind name="duty" value="'%'+query.queryDuty+'%'" /> and u.DUTY = #{duty} </if> </sql>
- 覆盖结果bean。org.gtiles.components.gtclasses.classstu.bean.ClassStuBean,增加要查询返回的字段。
public class ClassStuBean extends ClassStudent{ public ClassStuBean() { super(); } public ClassStuBean(ClassStuEntity classStuEntity) { super(classStuEntity); } }
- 覆盖查询bean。org.gtiles.components.gtclasses.classstu.bean.ClassStuQuery,增加要查询的查询条件。
public class ClassStuQuery extends ClassStudentAbstractQuery {
}
查询扩展
覆盖dao查询xml。org.gtiles.components.gtclasses.classstu.extension.IClassStuExtensionDao.xml,在xml中增加要查询的结果及查询条件。
public class ClassStuBean extends ClassStudent{ public ClassStuBean() { super(); } public ClassStuBean(ClassStuEntity classStuEntity) { super(classStuEntity); } }
public class ClassStuQuery extends ClassStudentAbstractQuery {
}