7 changed files with 107 additions and 8 deletions
@ -0,0 +1,25 @@ |
|||
package com.ccsens.form.persist.dao; |
|||
|
|||
import com.ccsens.form.bean.vo.FormVo; |
|||
import com.ccsens.form.persist.mapper.FormBasicMapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Repository |
|||
public interface FormBasicDao extends FormBasicMapper { |
|||
/** |
|||
* 查找填写人信息列表 |
|||
* @param formId 表单id |
|||
* @return 返回填写人信息列表 |
|||
*/ |
|||
List<FormVo.FormList> getFormList(@Param("formId") Long formId); |
|||
|
|||
/** |
|||
* 查询需要被统计的组件的统计信息 |
|||
* @param formId 表单id |
|||
* @return 返回统计信息 |
|||
*/ |
|||
List<FormVo.StatisticsModule> getStatisticsForm(@Param("formId") Long formId); |
|||
} |
@ -0,0 +1,54 @@ |
|||
<?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.ccsens.form.persist.dao.FormBasicDao"> |
|||
|
|||
<select id="getFormList" resultType="com.ccsens.form.bean.vo.FormVo$FormList"> |
|||
SELECT |
|||
id as formUserId, |
|||
user_name as `name`, |
|||
avatar_url as avatarUrl |
|||
FROM |
|||
t_form_user |
|||
WHERE |
|||
form_id = #{formId} |
|||
and submit_status = 1 |
|||
and rec_status = 0 |
|||
</select> |
|||
<select id="getStatisticsForm" resultType="com.ccsens.form.bean.vo.FormVo$StatisticsModule"> |
|||
SELECT |
|||
t.fmId as id, |
|||
t.config_value as title, |
|||
w.answer as optionKey, |
|||
COUNT(*) as nums |
|||
FROM |
|||
( |
|||
SELECT |
|||
fm.id as fmId, |
|||
c1.config_value |
|||
FROM |
|||
t_form_module_config c |
|||
LEFT JOIN t_form_module fm on c.form_module_id = fm.id |
|||
LEFT JOIN t_module m on fm.module_id = m.id |
|||
LEFT JOIN |
|||
(SELECT * FROM |
|||
t_form_module_config |
|||
WHERE type = 0 and config_key = 'title' and rec_status = 0) c1 |
|||
on c1.form_module_id = fm.id |
|||
WHERE |
|||
c.type = 2 |
|||
and c.rec_status = 0 |
|||
and fm.rec_status = 0 |
|||
and m.rec_status = 0 |
|||
) t |
|||
LEFT JOIN |
|||
( |
|||
SELECT |
|||
* |
|||
FROM |
|||
t_form_write |
|||
WHERE |
|||
rec_status = 0 |
|||
) w on t.fmId = w.form_module_id |
|||
GROUP BY t.fmId,w.answer |
|||
</select> |
|||
</mapper> |
Loading…
Reference in new issue