java110-bean/src/main/java/com/java110/dto/questionAnswerTitle/QuestionAnswerTitleDto.java
New file @@ -0,0 +1,104 @@ package com.java110.dto.questionAnswerTitle; import com.java110.dto.PageDto; import java.io.Serializable; import java.util.Date; /** * @ClassName FloorDto * @Description 答卷数据层封装 * @Author wuxw * @Date 2019/4/24 8:52 * @Version 1.0 * add by wuxw 2019/4/24 **/ public class QuestionAnswerTitleDto extends PageDto implements Serializable { private String titleType; private String titleId; private String objId; private String objType; private String seq; private String qaId; private String qaTitle; private Date createTime; private String statusCd = "0"; public String getTitleType() { return titleType; } public void setTitleType(String titleType) { this.titleType = titleType; } public String getTitleId() { return titleId; } public void setTitleId(String titleId) { this.titleId = titleId; } public String getObjId() { return objId; } public void setObjId(String objId) { this.objId = objId; } public String getObjType() { return objType; } public void setObjType(String objType) { this.objType = objType; } public String getSeq() { return seq; } public void setSeq(String seq) { this.seq = seq; } public String getQaId() { return qaId; } public void setQaId(String qaId) { this.qaId = qaId; } public String getQaTitle() { return qaTitle; } public void setQaTitle(String qaTitle) { this.qaTitle = qaTitle; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public String getStatusCd() { return statusCd; } public void setStatusCd(String statusCd) { this.statusCd = statusCd; } } java110-bean/src/main/java/com/java110/po/questionAnswerTitle/QuestionAnswerTitlePo.java
New file @@ -0,0 +1,67 @@ package com.java110.po.questionAnswerTitle; import java.io.Serializable; import java.util.Date; public class QuestionAnswerTitlePo implements Serializable { private String titleType; private String titleId; private String objId; private String statusCd = "0"; private String objType; private String seq; private String qaId; private String qaTitle; public String getTitleType() { return titleType; } public void setTitleType(String titleType) { this.titleType = titleType; } public String getTitleId() { return titleId; } public void setTitleId(String titleId) { this.titleId = titleId; } public String getObjId() { return objId; } public void setObjId(String objId) { this.objId = objId; } public String getStatusCd() { return statusCd; } public void setStatusCd(String statusCd) { this.statusCd = statusCd; } public String getObjType() { return objType; } public void setObjType(String objType) { this.objType = objType; } public String getSeq() { return seq; } public void setSeq(String seq) { this.seq = seq; } public String getQaId() { return qaId; } public void setQaId(String qaId) { this.qaId = qaId; } public String getQaTitle() { return qaTitle; } public void setQaTitle(String qaTitle) { this.qaTitle = qaTitle; } } java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java
@@ -181,6 +181,7 @@ public static final String CODE_PREFIX_classesId = "16"; public static final String CODE_PREFIX_rId = "17"; public static final String CODE_PREFIX_qaId = "18"; public static final String CODE_PREFIX_titleId = "19"; /** java110-db/src/main/resources/mapper/user/QuestionAnswerTitleServiceDaoImplMapper.xml
New file @@ -0,0 +1,124 @@ <?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="questionAnswerTitleServiceDaoImpl"> <!-- 保存答卷信息 add by wuxw 2018-07-03 --> <insert id="saveQuestionAnswerTitleInfo" parameterType="Map"> insert into question_answer_title( title_type,title_id,obj_id,obj_type,seq,qa_id,qa_title ) values ( #{titleType},#{titleId},#{objId},#{objType},#{seq},#{qaId},#{qaTitle} ) </insert> <!-- 查询答卷信息 add by wuxw 2018-07-03 --> <select id="getQuestionAnswerTitleInfo" parameterType="Map" resultType="Map"> select t.title_type,t.title_type titleType,t.title_id,t.title_id titleId,t.obj_id,t.obj_id objId,t.status_cd,t.status_cd statusCd,t.obj_type,t.obj_type objType,t.seq,t.qa_id,t.qa_id qaId,t.qa_title,t.qa_title qaTitle from question_answer_title t where 1 =1 <if test="titleType !=null and titleType != ''"> and t.title_type= #{titleType} </if> <if test="titleId !=null and titleId != ''"> and t.title_id= #{titleId} </if> <if test="objId !=null and objId != ''"> and t.obj_id= #{objId} </if> <if test="statusCd !=null and statusCd != ''"> and t.status_cd= #{statusCd} </if> <if test="objType !=null and objType != ''"> and t.obj_type= #{objType} </if> <if test="seq !=null and seq != ''"> and t.seq= #{seq} </if> <if test="qaId !=null and qaId != ''"> and t.qa_id= #{qaId} </if> <if test="qaTitle !=null and qaTitle != ''"> and t.qa_title= #{qaTitle} </if> order by t.create_time desc <if test="page != -1 and page != null "> limit #{page}, #{row} </if> </select> <!-- 修改答卷信息 add by wuxw 2018-07-03 --> <update id="updateQuestionAnswerTitleInfo" parameterType="Map"> update question_answer_title t set t.status_cd = #{statusCd} <if test="newBId != null and newBId != ''"> ,t.b_id = #{newBId} </if> <if test="titleType !=null and titleType != ''"> , t.title_type= #{titleType} </if> <if test="objId !=null and objId != ''"> , t.obj_id= #{objId} </if> <if test="objType !=null and objType != ''"> , t.obj_type= #{objType} </if> <if test="seq !=null and seq != ''"> , t.seq= #{seq} </if> <if test="qaId !=null and qaId != ''"> , t.qa_id= #{qaId} </if> <if test="qaTitle !=null and qaTitle != ''"> , t.qa_title= #{qaTitle} </if> where 1=1 <if test="titleId !=null and titleId != ''"> and t.title_id= #{titleId} </if> </update> <!-- 查询答卷数量 add by wuxw 2018-07-03 --> <select id="queryQuestionAnswerTitlesCount" parameterType="Map" resultType="Map"> select count(1) count from question_answer_title t where 1 =1 <if test="titleType !=null and titleType != ''"> and t.title_type= #{titleType} </if> <if test="titleId !=null and titleId != ''"> and t.title_id= #{titleId} </if> <if test="objId !=null and objId != ''"> and t.obj_id= #{objId} </if> <if test="statusCd !=null and statusCd != ''"> and t.status_cd= #{statusCd} </if> <if test="objType !=null and objType != ''"> and t.obj_type= #{objType} </if> <if test="seq !=null and seq != ''"> and t.seq= #{seq} </if> <if test="qaId !=null and qaId != ''"> and t.qa_id= #{qaId} </if> <if test="qaTitle !=null and qaTitle != ''"> and t.qa_title= #{qaTitle} </if> </select> </mapper> java110-generator/src/main/resources/newBack/template_1.json
@@ -15,7 +15,7 @@ "objType": "obj_type", "objId": "obj_id", "titleType": "title_type", "storeId": "seq" "seq": "seq" }, "required": [ { @@ -33,6 +33,10 @@ { "code": "objType", "msg": "问卷对象不能为空" }, { "code": "seq", "msg": "序号不能为空" } ] } java110-interface/src/main/java/com/java110/intf/user/IQuestionAnswerTitleInnerServiceSMO.java
New file @@ -0,0 +1,52 @@ package com.java110.intf.user; import com.java110.config.feign.FeignConfiguration; import com.java110.dto.questionAnswerTitle.QuestionAnswerTitleDto; import com.java110.po.questionAnswerTitle.QuestionAnswerTitlePo; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import java.util.List; /** * @ClassName IQuestionAnswerTitleInnerServiceSMO * @Description 答卷接口类 * @Author wuxw * @Date 2019/4/24 9:04 * @Version 1.0 * add by wuxw 2019/4/24 **/ @FeignClient(name = "user-service", configuration = {FeignConfiguration.class}) @RequestMapping("/questionAnswerTitleApi") public interface IQuestionAnswerTitleInnerServiceSMO { @RequestMapping(value = "/saveQuestionAnswerTitle", method = RequestMethod.POST) public int saveQuestionAnswerTitle(@RequestBody QuestionAnswerTitlePo questionAnswerTitlePo); @RequestMapping(value = "/updateQuestionAnswerTitle", method = RequestMethod.POST) public int updateQuestionAnswerTitle(@RequestBody QuestionAnswerTitlePo questionAnswerTitlePo); @RequestMapping(value = "/deleteQuestionAnswerTitle", method = RequestMethod.POST) public int deleteQuestionAnswerTitle(@RequestBody QuestionAnswerTitlePo questionAnswerTitlePo); /** * <p>查询小区楼信息</p> * * @param questionAnswerTitleDto 数据对象分享 * @return QuestionAnswerTitleDto 对象数据 */ @RequestMapping(value = "/queryQuestionAnswerTitles", method = RequestMethod.POST) List<QuestionAnswerTitleDto> queryQuestionAnswerTitles(@RequestBody QuestionAnswerTitleDto questionAnswerTitleDto); /** * 查询<p>小区楼</p>总记录数 * * @param questionAnswerTitleDto 数据对象分享 * @return 小区下的小区楼记录数 */ @RequestMapping(value = "/queryQuestionAnswerTitlesCount", method = RequestMethod.POST) int queryQuestionAnswerTitlesCount(@RequestBody QuestionAnswerTitleDto questionAnswerTitleDto); } service-user/src/main/java/com/java110/user/api/QuestionAnswerApi.java
@@ -2,11 +2,17 @@ import com.alibaba.fastjson.JSONObject; import com.java110.dto.questionAnswer.QuestionAnswerDto; import com.java110.dto.questionAnswerTitle.QuestionAnswerTitleDto; import com.java110.po.questionAnswer.QuestionAnswerPo; import com.java110.po.questionAnswerTitle.QuestionAnswerTitlePo; import com.java110.user.bmo.questionAnswer.IDeleteQuestionAnswerBMO; import com.java110.user.bmo.questionAnswer.IGetQuestionAnswerBMO; import com.java110.user.bmo.questionAnswer.ISaveQuestionAnswerBMO; import com.java110.user.bmo.questionAnswer.IUpdateQuestionAnswerBMO; import com.java110.user.bmo.questionAnswerTitle.IDeleteQuestionAnswerTitleBMO; import com.java110.user.bmo.questionAnswerTitle.IGetQuestionAnswerTitleBMO; import com.java110.user.bmo.questionAnswerTitle.ISaveQuestionAnswerTitleBMO; import com.java110.user.bmo.questionAnswerTitle.IUpdateQuestionAnswerTitleBMO; import com.java110.utils.util.Assert; import com.java110.utils.util.BeanConvertUtil; import org.springframework.beans.factory.annotation.Autowired; @@ -27,6 +33,16 @@ @Autowired private IGetQuestionAnswerBMO getQuestionAnswerBMOImpl; @Autowired private ISaveQuestionAnswerTitleBMO saveQuestionAnswerTitleBMOImpl; @Autowired private IUpdateQuestionAnswerTitleBMO updateQuestionAnswerTitleBMOImpl; @Autowired private IDeleteQuestionAnswerTitleBMO deleteQuestionAnswerTitleBMOImpl; @Autowired private IGetQuestionAnswerTitleBMO getQuestionAnswerTitleBMOImpl; /** * 微信保存消息模板 @@ -114,4 +130,90 @@ questionAnswerDto.setObjTd(QuestionAnswerDto.QA_TYPE_COMMUNITY.endsWith(objType) ? communityId : storeId); return getQuestionAnswerBMOImpl.get(questionAnswerDto); } /** * 微信保存消息模板 * * @param reqJson * @return * @serviceCode /questionAnswer/saveQuestionAnswerTitle * @path /app/questionAnswer/saveQuestionAnswerTitle */ @RequestMapping(value = "/saveQuestionAnswerTitle", method = RequestMethod.POST) public ResponseEntity<String> saveQuestionAnswerTitle(@RequestBody JSONObject reqJson) { Assert.hasKeyAndValue(reqJson, "qaId", "请求报文中未包含qaId"); Assert.hasKeyAndValue(reqJson, "qaTitle", "请求报文中未包含qaTitle"); Assert.hasKeyAndValue(reqJson, "titleType", "请求报文中未包含titleType"); Assert.hasKeyAndValue(reqJson, "objType", "请求报文中未包含objType"); Assert.hasKeyAndValue(reqJson, "seq", "请求报文中未包含seq"); QuestionAnswerTitlePo questionAnswerTitlePo = BeanConvertUtil.covertBean(reqJson, QuestionAnswerTitlePo.class); return saveQuestionAnswerTitleBMOImpl.save(questionAnswerTitlePo); } /** * 微信修改消息模板 * * @param reqJson * @return * @serviceCode /questionAnswer/updateQuestionAnswerTitle * @path /app/questionAnswer/updateQuestionAnswerTitle */ @RequestMapping(value = "/updateQuestionAnswerTitle", method = RequestMethod.POST) public ResponseEntity<String> updateQuestionAnswerTitle(@RequestBody JSONObject reqJson) { Assert.hasKeyAndValue(reqJson, "qaId", "请求报文中未包含qaId"); Assert.hasKeyAndValue(reqJson, "qaTitle", "请求报文中未包含qaTitle"); Assert.hasKeyAndValue(reqJson, "titleType", "请求报文中未包含titleType"); Assert.hasKeyAndValue(reqJson, "objType", "请求报文中未包含objType"); Assert.hasKeyAndValue(reqJson, "seq", "请求报文中未包含seq"); Assert.hasKeyAndValue(reqJson, "titleId", "titleId不能为空"); QuestionAnswerTitlePo questionAnswerTitlePo = BeanConvertUtil.covertBean(reqJson, QuestionAnswerTitlePo.class); return updateQuestionAnswerTitleBMOImpl.update(questionAnswerTitlePo); } /** * 微信删除消息模板 * * @param reqJson * @return * @serviceCode /questionAnswer/deleteQuestionAnswerTitle * @path /app/questionAnswer/deleteQuestionAnswerTitle */ @RequestMapping(value = "/deleteQuestionAnswerTitle", method = RequestMethod.POST) public ResponseEntity<String> deleteQuestionAnswerTitle(@RequestBody JSONObject reqJson) { Assert.hasKeyAndValue(reqJson, "communityId", "小区ID不能为空"); Assert.hasKeyAndValue(reqJson, "titleId", "titleId不能为空"); QuestionAnswerTitlePo questionAnswerTitlePo = BeanConvertUtil.covertBean(reqJson, QuestionAnswerTitlePo.class); return deleteQuestionAnswerTitleBMOImpl.delete(questionAnswerTitlePo); } /** * 微信删除消息模板 * * @param communityId 小区ID * @return * @serviceCode /questionAnswer/queryQuestionAnswerTitle * @path /app/questionAnswer/queryQuestionAnswerTitle */ @RequestMapping(value = "/queryQuestionAnswerTitle", method = RequestMethod.GET) public ResponseEntity<String> queryQuestionAnswerTitle(@RequestHeader(value = "store-id") String storeId, @RequestParam(value = "communityId", required = false) String communityId, @RequestParam(value = "objType") String objType, @RequestParam(value = "page") int page, @RequestParam(value = "row") int row) { QuestionAnswerTitleDto questionAnswerTitleDto = new QuestionAnswerTitleDto(); questionAnswerTitleDto.setPage(page); questionAnswerTitleDto.setRow(row); questionAnswerTitleDto.setObjType(objType); questionAnswerTitleDto.setObjId(QuestionAnswerDto.QA_TYPE_COMMUNITY.endsWith(objType) ? communityId : storeId); return getQuestionAnswerTitleBMOImpl.get(questionAnswerTitleDto); } } service-user/src/main/java/com/java110/user/bmo/questionAnswerTitle/IDeleteQuestionAnswerTitleBMO.java
New file @@ -0,0 +1,19 @@ package com.java110.user.bmo.questionAnswerTitle; import com.java110.po.questionAnswerTitle.QuestionAnswerTitlePo; import org.springframework.http.ResponseEntity; public interface IDeleteQuestionAnswerTitleBMO { /** * 修改答卷 * add by wuxw * * @param questionAnswerTitlePo * @return */ ResponseEntity<String> delete(QuestionAnswerTitlePo questionAnswerTitlePo); } service-user/src/main/java/com/java110/user/bmo/questionAnswerTitle/IGetQuestionAnswerTitleBMO.java
New file @@ -0,0 +1,16 @@ package com.java110.user.bmo.questionAnswerTitle; import com.java110.dto.questionAnswerTitle.QuestionAnswerTitleDto; import org.springframework.http.ResponseEntity; public interface IGetQuestionAnswerTitleBMO { /** * 查询答卷 * add by wuxw * @param questionAnswerTitleDto * @return */ ResponseEntity<String> get(QuestionAnswerTitleDto questionAnswerTitleDto); } service-user/src/main/java/com/java110/user/bmo/questionAnswerTitle/ISaveQuestionAnswerTitleBMO.java
New file @@ -0,0 +1,17 @@ package com.java110.user.bmo.questionAnswerTitle; import com.java110.po.questionAnswerTitle.QuestionAnswerTitlePo; import org.springframework.http.ResponseEntity; public interface ISaveQuestionAnswerTitleBMO { /** * 添加答卷 * add by wuxw * @param questionAnswerTitlePo * @return */ ResponseEntity<String> save(QuestionAnswerTitlePo questionAnswerTitlePo); } service-user/src/main/java/com/java110/user/bmo/questionAnswerTitle/IUpdateQuestionAnswerTitleBMO.java
New file @@ -0,0 +1,17 @@ package com.java110.user.bmo.questionAnswerTitle; import com.java110.po.questionAnswerTitle.QuestionAnswerTitlePo; import org.springframework.http.ResponseEntity; public interface IUpdateQuestionAnswerTitleBMO { /** * 修改答卷 * add by wuxw * @param questionAnswerTitlePo * @return */ ResponseEntity<String> update(QuestionAnswerTitlePo questionAnswerTitlePo); } service-user/src/main/java/com/java110/user/bmo/questionAnswerTitle/impl/DeleteQuestionAnswerTitleBMOImpl.java
New file @@ -0,0 +1,34 @@ package com.java110.user.bmo.questionAnswerTitle.impl; import com.java110.core.annotation.Java110Transactional; import com.java110.intf.user.IQuestionAnswerTitleInnerServiceSMO; import com.java110.po.questionAnswerTitle.QuestionAnswerTitlePo; import com.java110.user.bmo.questionAnswerTitle.IDeleteQuestionAnswerTitleBMO; import com.java110.vo.ResultVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; @Service("deleteQuestionAnswerTitleBMOImpl") public class DeleteQuestionAnswerTitleBMOImpl implements IDeleteQuestionAnswerTitleBMO { @Autowired private IQuestionAnswerTitleInnerServiceSMO questionAnswerTitleInnerServiceSMOImpl; /** * @param questionAnswerTitlePo 数据 * @return 订单服务能够接受的报文 */ @Java110Transactional public ResponseEntity<String> delete(QuestionAnswerTitlePo questionAnswerTitlePo) { int flag = questionAnswerTitleInnerServiceSMOImpl.deleteQuestionAnswerTitle(questionAnswerTitlePo); if (flag > 0) { return ResultVo.createResponseEntity(ResultVo.CODE_OK, "保存成功"); } return ResultVo.createResponseEntity(ResultVo.CODE_ERROR, "保存失败"); } } service-user/src/main/java/com/java110/user/bmo/questionAnswerTitle/impl/GetQuestionAnswerTitleBMOImpl.java
New file @@ -0,0 +1,44 @@ package com.java110.user.bmo.questionAnswerTitle.impl; import com.java110.dto.questionAnswerTitle.QuestionAnswerTitleDto; import com.java110.intf.user.IQuestionAnswerTitleInnerServiceSMO; import com.java110.user.bmo.questionAnswerTitle.IGetQuestionAnswerTitleBMO; import com.java110.vo.ResultVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; @Service("getQuestionAnswerTitleBMOImpl") public class GetQuestionAnswerTitleBMOImpl implements IGetQuestionAnswerTitleBMO { @Autowired private IQuestionAnswerTitleInnerServiceSMO questionAnswerTitleInnerServiceSMOImpl; /** * @param questionAnswerTitleDto * @return 订单服务能够接受的报文 */ public ResponseEntity<String> get(QuestionAnswerTitleDto questionAnswerTitleDto) { int count = questionAnswerTitleInnerServiceSMOImpl.queryQuestionAnswerTitlesCount(questionAnswerTitleDto); List<QuestionAnswerTitleDto> questionAnswerTitleDtos = null; if (count > 0) { questionAnswerTitleDtos = questionAnswerTitleInnerServiceSMOImpl.queryQuestionAnswerTitles(questionAnswerTitleDto); } else { questionAnswerTitleDtos = new ArrayList<>(); } ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) questionAnswerTitleDto.getRow()), count, questionAnswerTitleDtos); ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK); return responseEntity; } } service-user/src/main/java/com/java110/user/bmo/questionAnswerTitle/impl/SaveQuestionAnswerTitleBMOImpl.java
New file @@ -0,0 +1,38 @@ package com.java110.user.bmo.questionAnswerTitle.impl; import com.java110.core.annotation.Java110Transactional; import com.java110.core.factory.GenerateCodeFactory; import com.java110.intf.user.IQuestionAnswerTitleInnerServiceSMO; import com.java110.po.questionAnswerTitle.QuestionAnswerTitlePo; import com.java110.user.bmo.questionAnswerTitle.ISaveQuestionAnswerTitleBMO; import com.java110.vo.ResultVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; @Service("saveQuestionAnswerTitleBMOImpl") public class SaveQuestionAnswerTitleBMOImpl implements ISaveQuestionAnswerTitleBMO { @Autowired private IQuestionAnswerTitleInnerServiceSMO questionAnswerTitleInnerServiceSMOImpl; /** * 添加小区信息 * * @param questionAnswerTitlePo * @return 订单服务能够接受的报文 */ @Java110Transactional public ResponseEntity<String> save(QuestionAnswerTitlePo questionAnswerTitlePo) { questionAnswerTitlePo.setTitleId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_titleId)); int flag = questionAnswerTitleInnerServiceSMOImpl.saveQuestionAnswerTitle(questionAnswerTitlePo); if (flag > 0) { return ResultVo.createResponseEntity(ResultVo.CODE_OK, "保存成功"); } return ResultVo.createResponseEntity(ResultVo.CODE_ERROR, "保存失败"); } } service-user/src/main/java/com/java110/user/bmo/questionAnswerTitle/impl/UpdateQuestionAnswerTitleBMOImpl.java
New file @@ -0,0 +1,34 @@ package com.java110.user.bmo.questionAnswerTitle.impl; import com.java110.core.annotation.Java110Transactional; import com.java110.intf.user.IQuestionAnswerTitleInnerServiceSMO; import com.java110.po.questionAnswerTitle.QuestionAnswerTitlePo; import com.java110.user.bmo.questionAnswerTitle.IUpdateQuestionAnswerTitleBMO; import com.java110.vo.ResultVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; @Service("updateQuestionAnswerTitleBMOImpl") public class UpdateQuestionAnswerTitleBMOImpl implements IUpdateQuestionAnswerTitleBMO { @Autowired private IQuestionAnswerTitleInnerServiceSMO questionAnswerTitleInnerServiceSMOImpl; /** * @param questionAnswerTitlePo * @return 订单服务能够接受的报文 */ @Java110Transactional public ResponseEntity<String> update(QuestionAnswerTitlePo questionAnswerTitlePo) { int flag = questionAnswerTitleInnerServiceSMOImpl.updateQuestionAnswerTitle(questionAnswerTitlePo); if (flag > 0) { return ResultVo.createResponseEntity(ResultVo.CODE_OK, "保存成功"); } return ResultVo.createResponseEntity(ResultVo.CODE_ERROR, "保存失败"); } } service-user/src/main/java/com/java110/user/dao/IQuestionAnswerTitleServiceDao.java
New file @@ -0,0 +1,61 @@ package com.java110.user.dao; import com.java110.utils.exception.DAOException; import com.java110.entity.merchant.BoMerchant; import com.java110.entity.merchant.BoMerchantAttr; import com.java110.entity.merchant.Merchant; import com.java110.entity.merchant.MerchantAttr; import java.util.List; import java.util.Map; /** * 答卷组件内部之间使用,没有给外围系统提供服务能力 * 答卷服务接口类,要求全部以字符串传输,方便微服务化 * 新建客户,修改客户,删除客户,查询客户等功能 * * Created by wuxw on 2016/12/27. */ public interface IQuestionAnswerTitleServiceDao { /** * 保存 答卷信息 * @param info * @throws DAOException DAO异常 */ void saveQuestionAnswerTitleInfo(Map info) throws DAOException; /** * 查询答卷信息(instance过程) * 根据bId 查询答卷信息 * @param info bId 信息 * @return 答卷信息 * @throws DAOException DAO异常 */ List<Map> getQuestionAnswerTitleInfo(Map info) throws DAOException; /** * 修改答卷信息 * @param info 修改信息 * @throws DAOException DAO异常 */ void updateQuestionAnswerTitleInfo(Map info) throws DAOException; /** * 查询答卷总数 * * @param info 答卷信息 * @return 答卷数量 */ int queryQuestionAnswerTitlesCount(Map info); } service-user/src/main/java/com/java110/user/dao/impl/QuestionAnswerTitleServiceDaoImpl.java
New file @@ -0,0 +1,98 @@ package com.java110.user.dao.impl; import com.alibaba.fastjson.JSONObject; import com.java110.utils.constant.ResponseConstant; import com.java110.utils.exception.DAOException; import com.java110.utils.util.DateUtil; import com.java110.core.base.dao.BaseServiceDao; import com.java110.user.dao.IQuestionAnswerTitleServiceDao; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; /** * 答卷服务 与数据库交互 * Created by wuxw on 2017/4/5. */ @Service("questionAnswerTitleServiceDaoImpl") //@Transactional public class QuestionAnswerTitleServiceDaoImpl extends BaseServiceDao implements IQuestionAnswerTitleServiceDao { private static Logger logger = LoggerFactory.getLogger(QuestionAnswerTitleServiceDaoImpl.class); /** * 保存答卷信息 到 instance * @param info bId 信息 * @throws DAOException DAO异常 */ @Override public void saveQuestionAnswerTitleInfo(Map info) throws DAOException { logger.debug("保存答卷信息Instance 入参 info : {}",info); int saveFlag = sqlSessionTemplate.insert("questionAnswerTitleServiceDaoImpl.saveQuestionAnswerTitleInfo",info); if(saveFlag < 1){ throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存答卷信息Instance数据失败:"+ JSONObject.toJSONString(info)); } } /** * 查询答卷信息(instance) * @param info bId 信息 * @return List<Map> * @throws DAOException DAO异常 */ @Override public List<Map> getQuestionAnswerTitleInfo(Map info) throws DAOException { logger.debug("查询答卷信息 入参 info : {}",info); List<Map> businessQuestionAnswerTitleInfos = sqlSessionTemplate.selectList("questionAnswerTitleServiceDaoImpl.getQuestionAnswerTitleInfo",info); return businessQuestionAnswerTitleInfos; } /** * 修改答卷信息 * @param info 修改信息 * @throws DAOException DAO异常 */ @Override public void updateQuestionAnswerTitleInfo(Map info) throws DAOException { logger.debug("修改答卷信息Instance 入参 info : {}",info); int saveFlag = sqlSessionTemplate.update("questionAnswerTitleServiceDaoImpl.updateQuestionAnswerTitleInfo",info); if(saveFlag < 1){ throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改答卷信息Instance数据失败:"+ JSONObject.toJSONString(info)); } } /** * 查询答卷数量 * @param info 答卷信息 * @return 答卷数量 */ @Override public int queryQuestionAnswerTitlesCount(Map info) { logger.debug("查询答卷数据 入参 info : {}",info); List<Map> businessQuestionAnswerTitleInfos = sqlSessionTemplate.selectList("questionAnswerTitleServiceDaoImpl.queryQuestionAnswerTitlesCount", info); if (businessQuestionAnswerTitleInfos.size() < 1) { return 0; } return Integer.parseInt(businessQuestionAnswerTitleInfos.get(0).get("count").toString()); } } service-user/src/main/java/com/java110/user/smo/impl/QuestionAnswerTitleInnerServiceSMOImpl.java
New file @@ -0,0 +1,83 @@ package com.java110.user.smo.impl; import com.java110.core.base.smo.BaseServiceSMO; import com.java110.dto.PageDto; import com.java110.dto.questionAnswerTitle.QuestionAnswerTitleDto; import com.java110.intf.user.IQuestionAnswerTitleInnerServiceSMO; import com.java110.po.questionAnswerTitle.QuestionAnswerTitlePo; import com.java110.user.dao.IQuestionAnswerTitleServiceDao; import com.java110.utils.util.BeanConvertUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import java.util.List; /** * @ClassName FloorInnerServiceSMOImpl * @Description 答卷内部服务实现类 * @Author wuxw * @Date 2019/4/24 9:20 * @Version 1.0 * add by wuxw 2019/4/24 **/ @RestController public class QuestionAnswerTitleInnerServiceSMOImpl extends BaseServiceSMO implements IQuestionAnswerTitleInnerServiceSMO { @Autowired private IQuestionAnswerTitleServiceDao questionAnswerTitleServiceDaoImpl; @Override public int saveQuestionAnswerTitle(@RequestBody QuestionAnswerTitlePo questionAnswerTitlePo) { int saveFlag = 1; questionAnswerTitleServiceDaoImpl.saveQuestionAnswerTitleInfo(BeanConvertUtil.beanCovertMap(questionAnswerTitlePo)); return saveFlag; } @Override public int updateQuestionAnswerTitle(@RequestBody QuestionAnswerTitlePo questionAnswerTitlePo) { int saveFlag = 1; questionAnswerTitleServiceDaoImpl.updateQuestionAnswerTitleInfo(BeanConvertUtil.beanCovertMap(questionAnswerTitlePo)); return saveFlag; } @Override public int deleteQuestionAnswerTitle(@RequestBody QuestionAnswerTitlePo questionAnswerTitlePo) { int saveFlag = 1; questionAnswerTitlePo.setStatusCd("1"); questionAnswerTitleServiceDaoImpl.updateQuestionAnswerTitleInfo(BeanConvertUtil.beanCovertMap(questionAnswerTitlePo)); return saveFlag; } @Override public List<QuestionAnswerTitleDto> queryQuestionAnswerTitles(@RequestBody QuestionAnswerTitleDto questionAnswerTitleDto) { //校验是否传了 分页信息 int page = questionAnswerTitleDto.getPage(); if (page != PageDto.DEFAULT_PAGE) { questionAnswerTitleDto.setPage((page - 1) * questionAnswerTitleDto.getRow()); } List<QuestionAnswerTitleDto> questionAnswerTitles = BeanConvertUtil.covertBeanList(questionAnswerTitleServiceDaoImpl.getQuestionAnswerTitleInfo(BeanConvertUtil.beanCovertMap(questionAnswerTitleDto)), QuestionAnswerTitleDto.class); return questionAnswerTitles; } @Override public int queryQuestionAnswerTitlesCount(@RequestBody QuestionAnswerTitleDto questionAnswerTitleDto) { return questionAnswerTitleServiceDaoImpl.queryQuestionAnswerTitlesCount(BeanConvertUtil.beanCovertMap(questionAnswerTitleDto)); } public IQuestionAnswerTitleServiceDao getQuestionAnswerTitleServiceDaoImpl() { return questionAnswerTitleServiceDaoImpl; } public void setQuestionAnswerTitleServiceDaoImpl(IQuestionAnswerTitleServiceDao questionAnswerTitleServiceDaoImpl) { this.questionAnswerTitleServiceDaoImpl = questionAnswerTitleServiceDaoImpl; } }