Commit df440006 authored by luzhuang's avatar luzhuang

17图片管理

parent 7d81f11d
package org.rcisoft.business.bdefaultpic.controller;
/*固定导入*/
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.rcisoft.common.controller.PaginationController;
import org.rcisoft.common.model.GridModel;
import org.rcisoft.core.util.UserUtil;
import org.rcisoft.sys.user.bean.CurUser;
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.core.exception.ServiceException;
import javax.validation.Valid;
import org.rcisoft.business.bdefaultpic.entity.BDefaultPic;
import org.rcisoft.business.bdefaultpic.service.BDefaultPicService;
import java.util.List;
/**
* Created by on 2019-11-26 14:44:48.
*/
@Api(tags = "17 图片管理")
@RestController
@RequestMapping("bdefaultpic")
public class BDefaultPicController extends PaginationController<BDefaultPic> {
@Autowired
private BDefaultPicService bDefaultPicServiceImpl;
@ApiOperation(value="1701 添加", notes="添加")
@ApiImplicitParams({@ApiImplicitParam(name = "pic", value = "默认图片链接", required = false, dataType = "varchar")})
@PostMapping(value = "/add")
public Result add(CurUser curUser, String pic) {
PersistModel data = bDefaultPicServiceImpl.save(pic);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
pic);
}
@ApiOperation(value="1702 逻辑删除", notes="逻辑删除")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "主键id", required = false, dataType = "varchar")})
@DeleteMapping("/delete")
public Result delete(CurUser curUser, String businessId) {
BDefaultPic bDefaultPic = new BDefaultPic();
bDefaultPic.setBusinessId(businessId);
PersistModel data = bDefaultPicServiceImpl.remove(bDefaultPic);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
businessId);
}
@ApiOperation(value="1703 分页查询默认图片列表", notes="查看 集合")
@GetMapping(value = "/queryBDefaultPicByPagination")
public GridModel listByPagination(CurUser curUser) {
bDefaultPicServiceImpl.findAllByPagination(getPaginationUtility(), curUser);
return getGridModelResponse();
}
}
package org.rcisoft.business.bdefaultpic.dao;
import org.apache.ibatis.annotations.Param;
import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.business.bdefaultpic.entity.BDefaultPic;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Created with on 2019-11-26 14:44:48.
*/
@Repository
public interface BDefaultPicRepository extends BaseMapper<BDefaultPic> {
/**
* 分页查询 bDefaultPic
*
*/
@Select("<script>select * from b_default_pic where 1=1 " +
" and del_flag != 1 " +
" and flag = 1 " +
" and corp_id = #{corpId} "
+ "</script>")
@ResultMap(value = "BaseResultMap" )
List<BDefaultPic> queryBDefaultPics(@Param("corpId")String corpId);
}
package org.rcisoft.business.bdefaultpic.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 on 2019-11-26 14:44:48.
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "b_default_pic")
public class BDefaultPic extends IdEntity<BDefaultPic> {
private String pic;
}
package org.rcisoft.business.bdefaultpic.service;
import org.rcisoft.business.bdefaultpic.entity.BDefaultPic;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.sys.user.bean.CurUser;
import java.util.List;
/**
* Created by on 2019-11-26 14:44:48.
*/
public interface BDefaultPicService {
/**
* 保存
* @param pic
* @return
*/
PersistModel save(String pic);
/**
* 逻辑删除
* @param bDefaultPic
* @return
*/
PersistModel remove(BDefaultPic bDefaultPic);
/**
* 根据id查询
* @param id
* @return
*/
BDefaultPic findById(String id);
/**
* 分页查询
* @param curUser
* @return
*/
List<BDefaultPic> findAllByPagination(PageUtil<BDefaultPic> paginationUtility, CurUser curUser);
}
package org.rcisoft.business.bdefaultpic.service.impl;
import org.rcisoft.core.util.UserUtil;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.business.bdefaultpic.dao.BDefaultPicRepository;
import org.rcisoft.business.bdefaultpic.entity.BDefaultPic;
import org.rcisoft.business.bdefaultpic.service.BDefaultPicService;
import org.rcisoft.sys.user.bean.CurUser;
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 on 2019-11-26 14:44:48.
*/
@Service
@Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED)
@Slf4j
public class BDefaultPicServiceImpl implements BDefaultPicService {
@Autowired
private BDefaultPicRepository bDefaultPicRepository;
/**
* 保存 bDefaultPic
* @param pic
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public PersistModel save(String pic){
//增加操作
BDefaultPic bDefaultPic = new BDefaultPic();
bDefaultPic.setPic(pic);
UserUtil.setCurrentPersistOperation(bDefaultPic);
int line = bDefaultPicRepository.insertSelective(bDefaultPic);
return new PersistModel(line);
}
/**
* 逻辑删除
* @param bDefaultPic
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public PersistModel remove(BDefaultPic bDefaultPic){
UserUtil.setCurrentMergeOperation(bDefaultPic);
bDefaultPic.setDeleted();
int line = bDefaultPicRepository.logicalDelete(bDefaultPic);
return new PersistModel(line);
}
/**
* 根据id查询 bDefaultPic
* @param id
* @return
*/
public BDefaultPic findById(String id){
return bDefaultPicRepository.selectByPrimaryKey(id);
}
/**
* 分页查询 bDefaultPic
* @param curUser
* @return
*/
public List<BDefaultPic> findAllByPagination(PageUtil<BDefaultPic> paginationUtility, CurUser curUser){
return bDefaultPicRepository.queryBDefaultPics(curUser.getCorpId());
}
}
...@@ -424,8 +424,8 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> { ...@@ -424,8 +424,8 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
"<if test= \" examType != null and examType != '' and examType == '3'.toString()\"> and a.e_status = 0 </if> " + "<if test= \" examType != null and examType != '' and examType == '3'.toString()\"> and a.e_status = 0 </if> " +
"<if test= \" examResult != null and examResult != '' and examResult == '0'.toString() \"> and a.e_score &lt; b.p_pass_score </if> " + "<if test= \" examResult != null and examResult != '' and examResult == '0'.toString() \"> and a.e_score &lt; b.p_pass_score </if> " +
"<if test= \" examResult != null and examResult != '' and examResult == '1'.toString() \"> and a.e_score &gt;= b.p_pass_score </if> " + "<if test= \" examResult != null and examResult != '' and examResult == '1'.toString() \"> and a.e_score &gt;= b.p_pass_score </if> " +
"<if test= \" scoreStart != null and scoreStart != '' \"> and a.e_score &gt;= #{scoreStart} </if> " + "<if test= \" scoreStart != null and scoreStart != '' \"> and a.e_score &gt;= #{scoreStart} and a.e_status = 2 </if> " +
"<if test= \" scoreEnd != null and scoreEnd != '' \"> and a.e_score &lt;= #{scoreEnd} </if> " + "<if test= \" scoreEnd != null and scoreEnd != '' \"> and a.e_score &lt;= #{scoreEnd} and a.e_status = 2 </if> " +
"<if test= \" consumeTimeStart != null and consumeTimeStart != '' \"> and TIMESTAMPDIFF(MINUTE, a.e_starttime, a.e_endtime) &gt;= #{consumeTimeStart} </if> " + "<if test= \" consumeTimeStart != null and consumeTimeStart != '' \"> and TIMESTAMPDIFF(MINUTE, a.e_starttime, a.e_endtime) &gt;= #{consumeTimeStart} </if> " +
"<if test= \" consumeTimeEnd != null and consumeTimeEnd != '' \"> and TIMESTAMPDIFF(MINUTE, a.e_starttime, a.e_endtime) &lt;= #{consumeTimeEnd}</if> " + "<if test= \" consumeTimeEnd != null and consumeTimeEnd != '' \"> and TIMESTAMPDIFF(MINUTE, a.e_starttime, a.e_endtime) &lt;= #{consumeTimeEnd}</if> " +
"<if test= \" examTimeStart != null and examTimeStart != '' \"> and a.e_starttime &gt;= #{examTimeStart} </if> " + "<if test= \" examTimeStart != null and examTimeStart != '' \"> and a.e_starttime &gt;= #{examTimeStart} </if> " +
......
<?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.bdefaultpic.dao.BDefaultPicRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.bdefaultpic.entity.BDefaultPic">
<id column="business_id" jdbcType="VARCHAR" property="businessId"/>
<result column="pic" jdbcType="VARCHAR" property="pic"/>
<!-- <result column="lesson_type" jdbcType="VARCHAR" property="lessonType"/>-->
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="del_flag" jdbcType="VARCHAR" property="delFlag"/>
<result column="flag" jdbcType="VARCHAR" property="flag"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/>
<result column="corp_id" jdbcType="VARCHAR" property="corpId"/>
</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