dao层
ApplyBaseDao.java
public interface ApplyBaseDao extends EntityMapper<ApplyBase> {
public List<Map<String,String>> complexQuery(Map<String,String> map);
}
ApplyBaseDao.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="com.inspur.gcloud.bizapply.dao.ApplyBaseDao">
<resultMap id="resultMap" type="com.inspur.gcloud.bizapply.data.ApplyBase">
</resultMap>
<select id="complexQuery" resultType="map" parameterType="map">
SELECT
T.APPLY_NO,
T.ENT_NAME,
T.SOCIAL_CODE,
T.FORM_NAME,
T.FORM_ID,
T.SUBMIT_TIME,
V.CERT_NO
FROM
APPLY_BASE T,V_HF V
WHERE
T.DATA_ID = V.ID
<if test='applyNo !=null and applyNo !=""'>
AND INSTR(T.APPLY_NO,#{applyNo})>0
</if>
<if test='entName != null and entName !=""'>
AND INSTR(T.ENT_NAME,#{entName})>0
</if>
<if test='formName != null and formName !=""'>
AND INSTR(T.FORM_NAME,#{formName})>0
</if>
<if test='socialCode !=null and socialCode !=""'>
AND INSTR(T.SOCIAL_CODE,#{socialCode})>0
</if>
<if test='certNo !=null and certNo !=""'>
AND INSTR(V.CERT_NO,#{certNo})>0
</if>
<!-- <if test='beginTime !=null'>
AND T.SUBMIT_TIME <![CDATA[>=]]> #{beginTime}
</if> -->
<if test='beginTime !=null and beginTime !=""'>
AND T.SUBMIT_TIME <![CDATA[>=]]> TO_DATE(#{beginTime}, 'yyyy-mm-dd')
</if>
<if test='endTime !=null and endTime !=""'>
AND T.SUBMIT_TIME <![CDATA[<=]]> TO_DATE(#{endTime}, 'yyyy-mm-dd')
</if>
</select>
</mapper>
service层
IApplyBaseService.java
public interface IApplyBaseService {
public List<Map<String, String>> complexQuery(String entName, String formName, String socialCode, String certNo,
String applyNo, String beginTime, String endTime);
}
实现类:ApplyBaseService.java
@Service
public class ApplyBaseService implements IApplyBaseService {
@Autowired
private ApplyBaseDao dao;
/**
* @description 综合查询
* @param entName
*/
public List<Map<String,String>> complexQuery(String entName, String formName, String socialCode, String certNo,
String applyNo, String beginTime, String endTime){
Map<String,String> map = new HashMap<String,String>();
map.put("entName", entName);
map.put("formName", formName);
map.put("socialCode", socialCode);
map.put("certNo", certNo);
map.put("applyNo", applyNo);
map.put("beginTime", beginTime);
map.put("endTime", endTime);
List<Map<String,String>> list = dao.complexQuery(map);
if (list != null && list.size() > 0) {
return list;
}
return null;
}
}
controller层
@Controller
@RequestMapping(value = "/bizapply")
public class BizApplyController {
@Autowired
private IFoodMgtService foodMgtService;
@Autowired
private IApplyBaseService applyService;
/**
* @description 综合查询页面
* @return
*/
@RequestMapping(value = "/query",method = RequestMethod.GET)
@ResponseBody
public ModelAndView complexQuery(String entName,String formName,String socialCode,String certNo,
String applyNo, String beginTime, String endTime) {
Map<String, Object> model = new HashMap<String, Object>();
model.put("message", "欢迎进入查询页面");
List<Map<String, String>> data = applyService.complexQuery(entName, formName, socialCode, certNo,
applyNo, beginTime, endTime);
model.put("data",data);
return new ModelAndView("/bizapply/apply/query/complex_query",model);
}
/**
* @description 综合查询
* @return
*/
@RequestMapping(value = "/queryInfo",method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> queryInfo(String entName,String formName,String socialCode,String certNo,
String applyNo, String beginTime, String endTime, HttpServletRequest request) {
Map<String, Object> model = new HashMap<String, Object>();
List<Map<String, String>> data = applyService.complexQuery(entName, formName, socialCode, certNo,
applyNo, beginTime, endTime);
model.put("data", data);
model.put("total", data.size());
return model;
}
}
整体目录结构