Commit b07b3c4b authored by YangZhaoJun1's avatar YangZhaoJun1

修改

parent 92349e54
package org.rcisoft.business.texaminfo.dao;
import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.business.texamdetail.entity.TExamDetail;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Created with yangzhaojun on 2018-1-15 19:49:07.
*/
@Repository
public interface TExamDetailRepository extends BaseMapper<TExamDetail> {
/**
* 分页查询 tExamDetail
*
*/
@Select("<script>select * from t_exam_detail where 1=1 "
+ "<if test=\"delFlag !=null and delFlag != '' \">and del_flag = #{delFlag} </if>' "
+ "<if test=\"flag !=null and flag != '' \">and flag = #{flag} </if>' "
+ "</script>")
@ResultMap(value = "BaseResultMap" )
List<TExamDetail> queryTExamDetails(TExamDetail tExamDetail);
}
package org.rcisoft.business.texaminfo.entity;
import lombok.*;
import org.rcisoft.core.entity.IdEntity;
import javax.persistence.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* Created with yangzhaojun on 2018-1-15 19:49:07.
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "t_exam_detail")
public class TExamDetail extends IdEntity<TExamDetail> {
private String pId;
private String eId;
private String qId;
private String uId;
private String uAnswer;
private String qtype;
private Float pScore;
}
package org.rcisoft.business.tpaperdetail.dao;
package org.rcisoft.business.tpaper.dao;
import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.business.tpaperdetail.entity.TPaperDetail;
......
package org.rcisoft.business.tpaper.dao;
import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.business.tpapersection.entity.TPaperSection;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Created with yangzhaojun on 2018-1-15 19:49:07.
*/
@Repository
public interface TPaperSectionRepository extends BaseMapper<TPaperSection> {
/**
* 分页查询 tPaperSection
*
*/
@Select("<script>select * from t_paper_section where 1=1 "
+ "<if test=\"delFlag !=null and delFlag != '' \">and del_flag = #{delFlag} </if>' "
+ "<if test=\"flag !=null and flag != '' \">and flag = #{flag} </if>' "
+ "</script>")
@ResultMap(value = "BaseResultMap" )
List<TPaperSection> queryTPaperSections(TPaperSection tPaperSection);
}
package org.rcisoft.business.tpaperdetail.entity;
package org.rcisoft.business.tpaper.entity;
import lombok.*;
......
package org.rcisoft.business.tpaper.entity;
import lombok.*;
import org.rcisoft.core.entity.IdEntity;
import javax.persistence.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* Created with yangzhaojun on 2018-1-15 19:49:07.
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "t_paper_section")
public class TPaperSection extends IdEntity<TPaperSection> {
private String pId;
private String sdesc;
private Integer sorder;
}
package org.rcisoft.business.tpaperdetail.controller;
/*固定导入*/
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.BindingResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.rcisoft.core.result.Result;
import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.common.controller.PaginationController;
import org.rcisoft.core.util.UserUtil;
import org.rcisoft.common.model.GridModel;
import org.rcisoft.core.exception.ServiceException;
import javax.validation.Valid;
import org.rcisoft.business.tpaperdetail.entity.TPaperDetail;
import org.rcisoft.business.tpaperdetail.service.TPaperDetailService;
import java.util.List;
/**
* Created by yangzhaojun on 2018-1-15 19:49:07.
*/
@RestController
@RequestMapping("/t/paper/detail")
public class TPaperDetailController extends PaginationController<TPaperDetail> {
@Autowired
private TPaperDetailService tPaperDetailServiceImpl;
@ApiOperation(value="添加", notes="添加")
//@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
@PostMapping
public Result add(@Valid TPaperDetail tPaperDetail, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
throw new ServiceException(ResultServiceEnums.PARAMETER_ERROR.getCode(),
bindingResult.getFieldError().getDefaultMessage());
}
tPaperDetail.setToken(getToken());
PersistModel data = tPaperDetailServiceImpl.save(tPaperDetail);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
tPaperDetail);
}
@ApiOperation(value="逻辑删除", notes="逻辑删除")
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", required = false, dataType = "varchar")})
@DeleteMapping("/{id:\\d+}")
public Result delete(@PathVariable String id) {
TPaperDetail tPaperDetail = new TPaperDetail();
tPaperDetail.setBusinessId(id);
tPaperDetail.setToken(getToken());
PersistModel data = tPaperDetailServiceImpl.remove(tPaperDetail);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
id);
}
@ApiOperation(value="修改", notes="修改")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
@PutMapping("/{id:\\d+}")
public Result update(@Valid TPaperDetail tPaperDetail, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
throw new ServiceException(ResultServiceEnums.PARAMETER_ERROR.getCode(),
bindingResult.getFieldError().getDefaultMessage());
}
tPaperDetail.setToken(getToken());
PersistModel data = tPaperDetailServiceImpl.merge(tPaperDetail);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
tPaperDetail);
}
@ApiOperation(value="查看单 ", notes="查看单 ")
@GetMapping("/{id:\\d+}")
public Result detail(@PathVariable String id) {
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
tPaperDetailServiceImpl.findById(id));
}
@ApiOperation(value="查看 集合", notes="查看单 集合")
@GetMapping(value = "/queryTPaperDetailByPagination")
public GridModel listByPagination(TPaperDetail tPaperDetail) {
tPaperDetail.setCreateBy(UserUtil.getUserInfoProp(getToken(),UserUtil.USER_ID));
tPaperDetailServiceImpl.findAllByPagination(getPaginationUtility(), tPaperDetail);
return getGridModelResponse();
}
}
package org.rcisoft.business.tpaperdetail.service;
import org.rcisoft.business.tpaperdetail.entity.TPaperDetail;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.aop.PageUtil;
import java.util.List;
/**
* Created by yangzhaojun on 2018-1-15 19:49:07.
*/
public interface TPaperDetailService {
/**
* 保存
* @param tPaperDetail
* @return
*/
PersistModel save(TPaperDetail tPaperDetail);
/**
* 逻辑删除
* @param tPaperDetail
* @return
*/
PersistModel remove(TPaperDetail tPaperDetail);
/**
* 修改
* @param tPaperDetail
* @return
*/
PersistModel merge(TPaperDetail tPaperDetail);
/**
* 根据id查询
* @param id
* @return
*/
TPaperDetail findById(String id);
/**
* 分页查询
* @param tPaperDetail
* @return
*/
List<TPaperDetail> findAllByPagination(PageUtil<TPaperDetail> paginationUtility,
TPaperDetail tPaperDetail);
}
package org.rcisoft.business.tpaperdetail.service.impl;
import org.rcisoft.core.util.UserUtil;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.business.tpaperdetail.dao.TPaperDetailRepository;
import org.rcisoft.business.tpaperdetail.entity.TPaperDetail;
import org.rcisoft.business.tpaperdetail.service.TPaperDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/**
* Created by yangzhaojun on 2018-1-15 19:49:07.
*/
@Service
@Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED)
@Slf4j
public class TPaperDetailServiceImpl implements TPaperDetailService {
@Autowired
private TPaperDetailRepository tPaperDetailRepository;
/**
* 保存 tPaperDetail
* @param tPaperDetail
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public PersistModel save(TPaperDetail tPaperDetail){
tPaperDetail.setCommonBusinessId();
//增加操作
UserUtil.setCurrentPersistOperation(tPaperDetail);
int line = tPaperDetailRepository.insertSelective(tPaperDetail);
log.info(UserUtil.getUserInfoProp(tPaperDetail.getToken(),UserUtil.USER_USERNAME)+"新增了ID为"+
tPaperDetail.getBusinessId()+"的信息");
return new PersistModel(line);
}
/**
* 逻辑删除
* @param tPaperDetail
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public PersistModel remove(TPaperDetail tPaperDetail){
UserUtil.setCurrentMergeOperation(tPaperDetail);
int line = tPaperDetailRepository.logicalDelete(tPaperDetail);
log.info(UserUtil.getUserInfoProp(tPaperDetail.getToken(),UserUtil.USER_USERNAME)+"逻辑删除了ID为"+
tPaperDetail.getBusinessId()+"的信息");
return new PersistModel(line);
}
/**
* 修改 tPaperDetail
* @param tPaperDetail
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public PersistModel merge(TPaperDetail tPaperDetail){
UserUtil.setCurrentMergeOperation(tPaperDetail);
int line = tPaperDetailRepository.updateByPrimaryKeySelective(tPaperDetail);
log.info(UserUtil.getUserInfoProp(tPaperDetail.getToken(),UserUtil.USER_USERNAME)+"修改了ID为"+
tPaperDetail.getBusinessId()+"的信息");
return new PersistModel(line);
}
/**
* 根据id查询 tPaperDetail
* @param id
* @return
*/
public TPaperDetail findById(String id){
return tPaperDetailRepository.selectByPrimaryKey(id);
}
/**
* 分页查询 tPaperDetail
* @param tPaperDetail
* @return
*/
public List<TPaperDetail> findAllByPagination(PageUtil<TPaperDetail> paginationUtility,
TPaperDetail tPaperDetail){
return tPaperDetailRepository.queryTPaperDetails(tPaperDetail);
}
}
package org.rcisoft.business.tquestion.dao;
import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.business.tquestionoptions.entity.TQuestionOptions;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Created with yangzhaojun on 2018-1-15 19:49:07.
*/
@Repository
public interface TQuestionOptionsRepository extends BaseMapper<TQuestionOptions> {
/**
* 分页查询 tQuestionOptions
*
*/
@Select("<script>select * from t_question_options where 1=1 "
+ "<if test=\"delFlag !=null and delFlag != '' \">and del_flag = #{delFlag} </if>' "
+ "<if test=\"flag !=null and flag != '' \">and flag = #{flag} </if>' "
+ "</script>")
@ResultMap(value = "BaseResultMap" )
List<TQuestionOptions> queryTQuestionOptionss(TQuestionOptions tQuestionOptions);
}
package org.rcisoft.business.tquestion.entity;
import lombok.*;
import org.rcisoft.core.entity.IdEntity;
import javax.persistence.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* Created with yangzhaojun on 2018-1-15 19:49:07.
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "t_question_options")
public class TQuestionOptions extends IdEntity<TQuestionOptions> {
private String qid;
private String alias;
private String desc;
}
<?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.rcisoft.business.texamdetail.dao.TExamDetailRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.texamdetail.entity.TExamDetail">
<id column="business_id" jdbcType="VARCHAR" property="businessId"/>
<result column="p_id" jdbcType="VARCHAR" property="pId"/>
<result column="e_id" jdbcType="VARCHAR" property="eId"/>
<result column="q_id" jdbcType="VARCHAR" property="qId"/>
<result column="u_id" jdbcType="VARCHAR" property="uId"/>
<result column="u_answer" jdbcType="VARCHAR" property="uAnswer"/>
<result column="qtype" jdbcType="VARCHAR" property="qtype"/>
<result column="p_score" jdbcType="FLOAT" property="pScore"/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
</mapper>
\ No newline at end of file
<?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.rcisoft.business.tpapersection.dao.TPaperSectionRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.tpapersection.entity.TPaperSection">
<id column="business_id" jdbcType="VARCHAR" property="businessId"/>
<result column="p_id" jdbcType="VARCHAR" property="pId"/>
<result column="sdesc" jdbcType="VARCHAR" property="sdesc"/>
<result column="sorder" jdbcType="INTEGER" property="sorder"/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
</mapper>
\ No newline at end of file
<?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.rcisoft.business.tquestionoptions.dao.TQuestionOptionsRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.tquestionoptions.entity.TQuestionOptions">
<id column="business_id" jdbcType="VARCHAR" property="businessId"/>
<result column="qid" jdbcType="VARCHAR" property="qid"/>
<result column="alias" jdbcType="VARCHAR" property="alias"/>
<result column="desc" jdbcType="VARCHAR" property="desc"/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment