Commit fec74ef2 authored by 王淑君's avatar 王淑君

Merge branch 'wsj' into 'dev'

Wsj

See merge request !7
parents ed60f0b6 c9f71248
......@@ -20,7 +20,7 @@
<dependency>
<groupId>org.91isoft</groupId>
<artifactId>91isoft_spbt</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
......
......@@ -113,7 +113,7 @@
<dependency>
<groupId>org.91isoft</groupId>
<artifactId>91isoft_spbt</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
~~~
......
This diff is collapsed.
package org.rcisoft.business.bspace.dao;
import org.rcisoft.core.base.CyBaseMapper;
import org.rcisoft.business.bspace.entity.BSpace;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.rcisoft.core.base.CyBaseMapper;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* Created with on 2018-6-21 17:10:54.
*/
* Created with cy on 2018-12-17 13:50:52.
*/
@Repository
public interface BSpaceRepository extends CyBaseMapper<BSpace> {
/**
* 分页查询 bSpace
*
*/
* 分页查询 bSpace
*
*/
@Select("<script>select * from b_space where 1=1 "
+ "and del_flag = 0 "
+ "and flag = 1 "
+ "<if test=\"businessId !=null and businessId != '' \">and business_id = #{businessId} </if> "
+ "<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<BSpace> queryBSpaces(BSpace bSpace);
/**
* @param businessId
* @return
*/
@Select("select count(*) from b_space where del_flag = 0 and flag = 1 and business_id = #{businessId}")
int existSpace(String businessId);
/**
* 分页查询
* 分页增加
*
* */
@Select("<script>select * from b_space where flag = '1' and del_flag = '0' "
+ "and business_id = #{businessId}"
+ "</script>")
@ResultMap(value = "BaseResultMap" )
List<BSpace> querySpaceListsByName(BSpace spaceList);
/**
* 通过businessId查询
* @param spaceId
* @return
*/
@Select("select * from b_space b where b.flag = '1' and b.del_flag = '0' and b.business_id=#{spaceId}")
@ResultMap(value = "BaseResultMap" )
BSpace querySpaceListByBusinessId(String spaceId);
/**
* spaceAdd 新增
* @param spaceList
* @return
*/
@Select("<script>select * from b_space where flag = '1' and del_flag = '0' "
+ "and space_id = #{spaceId} "
+ "</script>")
@ResultMap(value = "BaseResultMap" )
List<BSpace> querySpaceListsByCodeOrName(BSpace spaceList);
/**
* 分页查询 bSpaceCategory
*查询空间列表 不分页
*/
@Select("<script>select * from b_space where "
+ " del_flag = 0 and flag = 1 </script>")
@ResultMap(value = "BaseResultMap" )
List<BSpace> queryBSpaceCategorys(BSpace spaceList);
@Select("<script> SELECT " +
"bs.space_name as spaceName, bs.space_id as spaceId, " +
"DATE_FORMAT( bs.create_date, '%Y-%m-%d' ) AS date " +
"FROM " +
"b_space bs " +
"WHERE " +
"1 = 1 " +
"AND bs.create_date BETWEEN '2018-7-28' " +
"AND '2018-8-28' " +
"GROUP BY " +
"bs.business_id, " +
"date " +
"</script>")
List<Map<String, Object>> queryAllSpacesByTime(String beginTime, String endTime);
/**
* 查询空间数
* @param spaceList
* @return
*/
@Select("select count(*) as spaceNum from b_space bs where bs.del_flag = 0 and bs.flag = 1")
List<BSpace> querySpaceNum(BSpace spaceList);
}
......@@ -2,36 +2,47 @@ package org.rcisoft.business.bspace.entity;
import lombok.*;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.rcisoft.core.entity.CyIdEntity;
import org.springframework.data.annotation.Transient;
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 2018-6-21 17:10:54.
*/
* Created with cy on 2018-12-17 13:50:51.
*/
@Entity
@Data
@Table(name = "b_space")
@NoArgsConstructor
@AllArgsConstructor
public class BSpace extends CyIdEntity<BSpace> {
@Table(name = "b_space")
public class BSpace extends CyIdEntity<BSpace> {
private static final long serialVersionUID = -2165299707591725301L;
@Length(min=1,max=64,message="长度最小为1,最大为50")
@NotBlank
private String spaceName;
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
@NotBlank
/**
* @desc 空间编号
* @column space_id
* @default
*/
private String spaceId;
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
@NotBlank
/**
* @desc 空间名
* @column space_name
* @default
*/
private String spaceName;
/**
* @desc 域名
* @column realm_name
* @default
*/
private String realmName;
@Transient
private String spaceNum;
}
package org.rcisoft.business.bspace.service;
import org.rcisoft.business.bspace.entity.BSpace;
import org.rcisoft.core.aop.CyPageUtil;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.aop.CyPageUtil;
import java.util.List;
import java.util.Map;
/**
* Created by on 2018-6-21 17:10:54.
* Created by cy on 2018-12-17 13:50:52.
*/
public interface BSpaceService {
/**
* 保存
*
* @param bSpace
* @return
*/
* 保存
* @param bSpace
* @return
*/
CyPersistModel save(BSpace bSpace);
/**
* 逻辑删除
*
* @param bSpace
* @return
*/
* 删除
* @param bSpace
* @return
*/
CyPersistModel remove(BSpace bSpace);
/**
* 修改
*
* @param bSpace
* @return
*/
CyPersistModel merge(BSpace bSpace);
* 逻辑删除
* @param bSpace
* @return
*/
CyPersistModel removeLogical(BSpace bSpace);
/**
* 根据id查询
*
* @param id
* @return
*/
BSpace findById(String id);
* 修改
* @param bSpace
* @return
*/
CyPersistModel merge(BSpace bSpace);
/**
* 分页查询
*
* @param bSpace
* @return
*/
List<BSpace> findAllByPagination(CyPageUtil<BSpace> paginationUtility, BSpace bSpace);
/**
* @param bSpace
* @return java.util.List<org.rcisoft.business.bspace.entity.BSpace>
* @author ningxy
* @description 不分页查询所有空间
* @date 2018/7/20 下午1:36
*/
List<BSpace> listAllSpaces(BSpace bSpace);
* 根据id查询
* @param id
* @return
*/
BSpace findById(String id);
/**
* 增加/修改
* @param spaceList
* @param token
* @return
*/
* 分页查询
* @param bSpace
* @return
*/
List<BSpace> findAllByPagination(CyPageUtil<BSpace> paginationUtility,
BSpace bSpace);
int persistSpaceList(BSpace spaceList, String token);
/**
* 通过businessId查询
* @param businessId
* @return
*/
BSpace querySpaceListByBusinessId(String businessId);
/**
* 查询 分页
* 查询所有角色,不分页
*/
List<BSpace> querySpaceListsByPagination(CyPageUtil<BSpace> paginationUtility, BSpace spaceList);
* 查询list
* @param bSpace
* @return
*/
List<BSpace> findAll(BSpace bSpace);
/**
* 查询空间数
* @param spaceList
* @return
*/
List<BSpace> querySpaceNum(BSpace spaceList);
}
package org.rcisoft.business.bspace.service.impl;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.core.aop.CyPageUtil;
import org.rcisoft.core.exception.CyServiceException;
import org.rcisoft.core.result.CyResultServiceExceptionEnums;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.aop.CyPageUtil;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.business.bspace.dao.BSpaceRepository;
import org.rcisoft.business.bspace.entity.BSpace;
import org.rcisoft.business.bspace.service.BSpaceService;
import org.rcisoft.core.service.CyBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
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.*;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/**
* Created by on 2018-6-21 17:10:54.
* Created by cy on 2018-12-17 13:50:52.
*/
@Service
@Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED)
@Slf4j
@ConfigurationProperties(prefix = "cy.model.security", ignoreUnknownFields = true,ignoreInvalidFields = true)
public class BSpaceServiceImpl implements BSpaceService {
public class BSpaceServiceImpl extends CyBaseService implements BSpaceService {
private static final long serialVersionUID = -3485875433825192456L;
@Autowired
private BSpaceRepository bSpaceRepository;
/**
* 保存 bSpace
* @param bSpace
* @return
*/
* 保存
* @param bSpace
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel save(BSpace bSpace){
//增加操作
CyUserUtil.setCurrentPersistOperation(bSpace);
int line = bSpaceRepository.insertSelective(bSpace);
log.info(CyUserUtil.getUserInfoProp(bSpace.getToken(),CyUserUtil.USER_USERNAME)+"新增了ID为"+
bSpace.getBusinessId()+"的信息");
this.dbInfo(CyUserUtil.getAuthenUsername() + "新增了ID为"+bSpace.getBusinessId()+"的信息","新增");
log.info(CyUserUtil.getAuthenUsername()+"新增了ID为"+
bSpace.getBusinessId()+"的信息");
return new CyPersistModel(line);
}
/**
* 逻辑删除
* @param bSpace
* @return
*/
* 删除
* @param bSpace
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel remove(BSpace bSpace){
int line = bSpaceRepository.deleteByPrimaryKey(bSpace.getBusinessId());
this.dbInfo(CyUserUtil.getAuthenUsername()+"删除了ID为"+bSpace.getBusinessId()+"的信息","删除");
log.info(CyUserUtil.getAuthenUsername()+"删除了ID为"+bSpace.getBusinessId()+"的信息");
return new CyPersistModel(line);
}
/**
* 逻辑删除
* @param bSpace
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel removeLogical(BSpace bSpace){
CyUserUtil.setCurrentMergeOperation(bSpace);
bSpace.setDeleted();
int line = bSpaceRepository.logicalDelete(bSpace);
log.info(CyUserUtil.getUserInfoProp(bSpace.getToken(),CyUserUtil.USER_USERNAME)+"逻辑删除了ID为"+
bSpace.getBusinessId()+"的信息");
this.dbInfo(CyUserUtil.getAuthenUsername()+"逻辑删除了ID为"+bSpace.getBusinessId()+"的信息","逻辑删除");
log.info(CyUserUtil.getAuthenUsername()+"逻辑删除了ID为"+bSpace.getBusinessId()+"的信息");
return new CyPersistModel(line);
}
/**
* 修改 bSpace
* @param bSpace
* @return
*/
* 修改
* @param bSpace
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel merge(BSpace bSpace){
CyUserUtil.setCurrentMergeOperation(bSpace);
int line = bSpaceRepository.updateByPrimaryKeySelective(bSpace);
log.info(CyUserUtil.getUserInfoProp(bSpace.getToken(),CyUserUtil.USER_USERNAME)+"修改了ID为"+
bSpace.getBusinessId()+"的信息");
this.dbInfo(CyUserUtil.getAuthenUsername()+"修改了ID为"+bSpace.getBusinessId()+"的信息","修改");
log.info(CyUserUtil.getAuthenUsername()+"修改了ID为"+bSpace.getBusinessId()+"的信息");
return new CyPersistModel(line);
}
/**
* 根据id查询 bSpace
* @param id
* @return
*/
* 根据id查询
* @param id
* @return
*/
@Override
public BSpace findById(String id){
return bSpaceRepository.selectByPrimaryKey(id);
}
/**
* 分页查询 bSpace
* @param bSpace
* @return
*/
* 分页查询
* @param bSpace
* @return
*/
@Override
public List<BSpace> findAllByPagination(CyPageUtil<BSpace> paginationUtility,
BSpace bSpace){
bSpace.setStart();
bSpace.setNotDeleted();
BSpace bSpace){
bSpace.setNormal();
return bSpaceRepository.queryBSpaces(bSpace);
}
/**
* @param bSpace
* @return java.util.List<org.rcisoft.business.bspace.entity.BSpace>
* @author ningxy
* @description 不分页查询所有空间
* @date 2018/7/20 下午1:36
*/
* 查询list
* @param bSpace
* @return
*/
@Override
public List<BSpace> listAllSpaces(BSpace bSpace) {
public List<BSpace> findAll(BSpace bSpace){
bSpace.setNormal();
return bSpaceRepository.queryBSpaces(bSpace);
}
/**
* 增加
*
* */
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public int persistSpaceList(BSpace spaceList, String token ) {
int line;
int line2=0;
int result = 0;
if(StringUtils.isNotBlank(spaceList.getBusinessId())){//修改
List<BSpace> spaceLists = bSpaceRepository.querySpaceListsByName(spaceList);
if(spaceLists.size() == 0){
throw new CyServiceException(CyResultServiceExceptionEnums.USER_EXISTS);
}
// Example example = new Example(BCategory.class);
// example.createCriteria().andEqualTo("spaceId",spaceList.getBusinessId());
// BCategory bcategory = new BCategory();
CyUserUtil.setCurrentMergeOperation(spaceList);
// bcategory.setCategoryName(spaceList.getSpaceName());
// bcategory.setSpaceId(spaceList.getBusinessId());
line = bSpaceRepository.updateByPrimaryKeySelective(spaceList);
// line2 = bCategoryRepository.updateByExampleSelective(bcategory,example);
}else{//增加
List<BSpace> spaceLists = bSpaceRepository.querySpaceListsByCodeOrName(spaceList);
if(spaceLists.size()>0){
throw new CyServiceException(CyResultServiceExceptionEnums.USER_EXISTS);
}
// BCategory bcategory = new BCategory();
// CyUserUtil.setCurrentPersistOperation(spaceList);
// CyUserUtil.setCurrentPersistOperation(bcategory);
// bcategory.setSpaceId(spaceList.getBusinessId());
// bcategory.setCategoryName(spaceList.getSpaceName());
// bcategory.setPid(0);
line = bSpaceRepository.insertSelective(spaceList);
// line2 = bCategoryRepository.insertSelective(bcategory);
}
// if(line == line2){
// result = line;
// }
return line;
}
/**
* 通过businessId查询
* @param businessId
* @return
*/
@Override
public BSpace querySpaceListByBusinessId(String businessId) {
return bSpaceRepository.querySpaceListByBusinessId(businessId);
}
@Override
public List<BSpace> querySpaceListsByPagination(CyPageUtil<BSpace> paginationUtility, BSpace spaceList) {
return bSpaceRepository.queryBSpaceCategorys(spaceList);
}
/**
* 查询空间数
* @param spaceList
* @return
*/
@Override
public List<BSpace> querySpaceNum(BSpace spaceList) {
return bSpaceRepository.querySpaceNum(spaceList);
}
}
......@@ -16,7 +16,7 @@ server:
# org.springframework.web: DEBUG
druid:
url: jdbc:mysql://127.0.0.1:3306/mall2?useUnicode=true&characterEncoding=UTF-8&useSSL=false&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true
url: jdbc:mysql://127.0.0.1:3306/mall4?useUnicode=true&characterEncoding=UTF-8&useSSL=false&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true
username: root
password: 123456
initial-size: 1
......
......@@ -54,9 +54,9 @@
<connectionSource class="ch.qos.logback.core.db.DataSourceConnectionSource">
<dataSource class="org.apache.tomcat.jdbc.pool.DataSource">
<driverClassName class="com.mysql.jdbc.Driver" />
<url>jdbc:mysql://127.0.0.1:3306/family?characterEncoding=UTF-8</url>
<url>jdbc:mysql://127.0.0.1:3306/mall3?characterEncoding=UTF-8</url>
<username>root</username>
<password>cy</password>
<password>123456</password>
</dataSource>
</connectionSource>
......@@ -81,13 +81,11 @@
</appender>
<!-- 用户操作日志logger -->
<logger name="DBLog" level="INFO" >
<appender-ref ref="DBLog"/>
</logger>
<!--<logger name="DBLog" level="INFO" >-->
<!--<appender-ref ref="DBLog"/>-->
<!--</logger>-->
<!--
指定对应包名
-->
<!--指定对应包名 -->
<logger name="com.minlia" level="DEBUG"/>
<logger name="org.springframework.data.mybatis" level="DEBUG"/>
<logger name="org.springframework.aop.aspectj" level="ERROR"/>
......
<?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.bspace.dao.BSpaceRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.bspace.entity.BSpace">
<id column="business_id" jdbcType="VARCHAR" property="businessId" />
<result column="space_name" jdbcType="VARCHAR" property="spaceName" />
<result column="space_id" jdbcType="VARCHAR" property="spaceId" />
<result column="CREATE_BY" property="createBy" jdbcType="VARCHAR" />
<result column="FLAG" property="flag" jdbcType="VARCHAR" />
<result column="REMARKS" property="remarks" jdbcType="VARCHAR" />
<result column="UPDATE_BY" property="updateBy" jdbcType="VARCHAR" />
<result column="DEL_FLAG" property="delFlag" jdbcType="VARCHAR" />
<result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
<result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
<result column="realm_name" property="realmName" jdbcType="VARCHAR" />
</resultMap>
</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.bspace.dao.BSpaceRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.bspace.entity.BSpace">
<id column="business_id" jdbcType="VARCHAR" property="businessId"/>
<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="space_id" jdbcType="VARCHAR" property="spaceId"/>
<result column="space_name" jdbcType="VARCHAR" property="spaceName"/>
<result column="realm_name" jdbcType="VARCHAR" property="realmName"/>
</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