Browse Source

机构:新增、修改、启用/停用 查询功能测试完毕

hgw 3 years ago
parent
commit
1e3757a496

+ 1 - 4
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/TenantInfoDao.java

@@ -6,14 +6,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ym.mec.biz.dal.entity.TenantInfo;
 import org.apache.ibatis.annotations.Param;
 
-import java.util.List;
 import java.util.Map;
 
 public interface TenantInfoDao extends BaseMapper<TenantInfo> {
 
-    List<TenantInfo> queryList(@Param("param") Map<String, Object> param);
-
-    int opsTenantState(Integer id, Integer state);
+    int opsTenantState(@Param("id") Integer id, @Param("state") Integer state);
 
     <T> IPage<T> queryPage(Page<T> page, @Param("param") Map<String, Object> param);
 }

+ 0 - 11
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/TenantProductInfoDao.java

@@ -4,15 +4,4 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ym.mec.biz.dal.entity.TenantProductInfo;
 
 public interface TenantProductInfoDao extends BaseMapper<TenantProductInfo> {
-    int deleteByPrimaryKey(Integer id);
-
-    int insert(TenantProductInfo record);
-
-    int insertSelective(TenantProductInfo record);
-
-    TenantProductInfo selectByPrimaryKey(Integer id);
-
-    int updateByPrimaryKeySelective(TenantProductInfo record);
-
-    int updateByPrimaryKey(TenantProductInfo record);
 }

+ 3 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/TenantConfig.java

@@ -1,6 +1,8 @@
 package com.ym.mec.biz.dal.entity;
 
+import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
@@ -16,7 +18,7 @@ import java.util.Date;
  */
 @ApiModel(value = "机构配置表")
 public class TenantConfig implements Serializable {
-    @TableField("id_")
+    @TableId(value = "id_", type = IdType.AUTO)
     @ApiModelProperty(value = "主键")
     private Integer id;
 

+ 3 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/TenantInfo.java

@@ -1,6 +1,8 @@
 package com.ym.mec.biz.dal.entity;
 
+import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.builder.ToStringBuilder;
@@ -14,7 +16,7 @@ import java.util.Date;
  */
 @ApiModel(value = "TenantInfo机构表")
 public class TenantInfo implements Serializable {
-    @TableField("id_")
+    @TableId(value = "id_", type = IdType.AUTO)
     @ApiModelProperty(value = "机构id")
     private Integer id;
 

+ 3 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/TenantProductInfo.java

@@ -1,6 +1,8 @@
 package com.ym.mec.biz.dal.entity;
 
+import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
@@ -16,7 +18,7 @@ import java.util.Date;
  */
 @ApiModel(value = "机构产品设置表")
 public class TenantProductInfo implements Serializable {
-    @TableField("id_")
+    @TableId(value = "id_", type = IdType.AUTO)
     @ApiModelProperty(value = "主键")
     private Integer id;
 

+ 5 - 8
mec-biz/src/main/java/com/ym/mec/biz/event/listener/TenantConfigListener.java

@@ -1,16 +1,15 @@
 package com.ym.mec.biz.event.listener;
 
-import com.ym.mec.biz.dal.dao.TenantInfoDao;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.ym.mec.biz.dal.entity.TenantInfo;
 import com.ym.mec.biz.event.TenantConfigChangeEvent;
 import com.ym.mec.biz.service.SysTenantConfigService;
+import com.ym.mec.biz.service.TenantInfoService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.ApplicationListener;
 import org.springframework.stereotype.Component;
 
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
 @Component
@@ -19,21 +18,19 @@ public class TenantConfigListener implements ApplicationListener<TenantConfigCha
     @Autowired
     private SysTenantConfigService sysTenantConfigService;
     @Autowired
-    private TenantInfoDao tenantInfoDao;
+    private TenantInfoService tenantInfoService;
 
     @Override
     public void onApplicationEvent(TenantConfigChangeEvent event) {
         if(event.getTenantId() != null){
-            TenantInfo tenantInfo = tenantInfoDao.selectByPrimaryKey(event.getTenantId());
+            TenantInfo tenantInfo = tenantInfoService.getById(event.getTenantId());
             if(tenantInfo != null){
                 ConcurrentHashMap<Integer, ConcurrentHashMap<String, String>> allTenantConfig = sysTenantConfigService.getAllTenantConfig();
                 allTenantConfig.put(tenantInfo.getId(),sysTenantConfigService.queryAllMap(tenantInfo.getId()));
                 sysTenantConfigService.setTenantConfig(allTenantConfig);
             }
         }else {
-            Map<String,Object> paramMap = new HashMap<>(1);
-            paramMap.put("state",1);
-            List<TenantInfo> tenantInfos = tenantInfoDao.queryList(paramMap);
+            List<TenantInfo> tenantInfos = tenantInfoService.list(new QueryWrapper<TenantInfo>().eq("state_",1));
             if(tenantInfos != null && tenantInfos.size() > 0){
                 ConcurrentHashMap<Integer,ConcurrentHashMap<String,String>> tenantConfig = new ConcurrentHashMap<>(tenantInfos.size());
                 for (TenantInfo tenantInfo : tenantInfos) {

+ 3 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/TenantInfoService.java

@@ -1,12 +1,14 @@
 package com.ym.mec.biz.service;
 
+import com.baomidou.mybatisplus.extension.service.IService;
 import com.ym.mec.biz.dal.dto.TenantInfoDto;
+import com.ym.mec.biz.dal.entity.TenantInfo;
 import com.ym.mec.biz.dal.vo.TenantInfoInfoPageVo;
 import com.ym.mec.common.page.PageInfo;
 
 import java.util.Map;
 
-public interface TenantInfoService {
+public interface TenantInfoService extends IService<TenantInfo> {
 
     void addTenantInfo(TenantInfoDto dto);
 

+ 4 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentGoodsSellServiceImpl.java

@@ -2,19 +2,18 @@ package com.ym.mec.biz.service.impl;
 
 
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.GoodsSellDto;
 import com.ym.mec.biz.dal.dto.StudentGoodsSellDto;
 import com.ym.mec.biz.dal.dto.StudentPaymentOrderDto;
-import com.ym.mec.biz.dal.dto.SysCouponCodeDto;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.page.GoodsSellQueryInfo;
 import com.ym.mec.biz.service.StudentGoodsSellService;
 import com.ym.mec.biz.service.SysConfigService;
+import com.ym.mec.biz.service.TenantInfoService;
 import com.ym.mec.common.dal.BaseDAO;
-import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
-import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.util.collection.MapUtil;
 import org.apache.commons.lang3.StringUtils;
@@ -35,7 +34,7 @@ public class StudentGoodsSellServiceImpl extends BaseServiceImpl<Integer, Studen
     @Autowired
     private SysTenantConfigDao sysTenantConfigDao;
     @Autowired
-    private TenantInfoDao tenantInfoDao;
+    private TenantInfoService tenantInfoService;
     @Autowired
     private GoodsDao goodsDao;
     @Autowired
@@ -85,9 +84,7 @@ public class StudentGoodsSellServiceImpl extends BaseServiceImpl<Integer, Studen
         //如果订单编号为空,那么自动确认
         StringBuffer sb = new StringBuffer();
         str = "AUTO_RECEIVE";
-        Map<String,Object> param = new HashMap<>(1);
-        param.put("state",1);
-        List<TenantInfo> tenantInfos = tenantInfoDao.queryList(param);
+        List<TenantInfo> tenantInfos = tenantInfoService.list(new QueryWrapper<TenantInfo>().eq("state_",1));
         if(tenantInfos != null && tenantInfos.size() > 0){
             for (int i = 0; i < tenantInfos.size(); i++) {
                 TenantInfo tenantInfo = tenantInfos.get(i);

+ 1 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantInfoServiceImpl.java

@@ -24,10 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.Date;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
+import java.util.*;
 import java.util.function.Consumer;
 
 @Service

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantProductInfoServiceImpl.java

@@ -29,7 +29,7 @@ public class TenantProductInfoServiceImpl extends ServiceImpl<TenantProductInfoD
     public void updateTenantProduct(TenantProductInfoDto dto) {
         TenantProductInfo info = new TenantProductInfo();
         BeanUtils.copyProperties(dto, info);
-        baseMapper.updateByPrimaryKeySelective(info);
+        baseMapper.updateById(info);
     }
 
 

+ 1 - 15
mec-biz/src/main/resources/config/mybatis/TenantInfoMapper.xml

@@ -29,21 +29,7 @@
     data_source_, pay_state_, state_, created_by_, created_time_, updated_by_, updated_time_
     </sql>
 
-    <select id="queryList" resultMap="BaseResultMap">
-        select
-        <include refid="Base_Column_List"/>
-        from tenant_info
-        <where>
-            <if test="param.state != null">
-                AND state_ = #{param.state,jdbcType=INTEGER}
-            </if>
-            <if test="param.id != null">
-                AND id_ = #{param.id,jdbcType=INTEGER}
-            </if>
-        </where>
-    </select>
-
-    <update id="opsTenantState">
+    <update id="opsTenantState" parameterType="object">
         update tenant_info
         set state_ = #{state}
         where id_ = #{id}

+ 1 - 127
mec-biz/src/main/resources/config/mybatis/TenantProductInfoMapper.xml

@@ -17,131 +17,5 @@
     id_, tenant_id_, serve_id_, serve_detail_id_, original_price_, contract_price_, pay_amount_, 
     expiry_count_, expiry_unit_, expiry_data_
   </sql>
-  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
-    select 
-    <include refid="Base_Column_List" />
-    from tenant_product_info
-    where id_ = #{id,jdbcType=INTEGER}
-  </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
-    delete from tenant_product_info
-    where id_ = #{id,jdbcType=INTEGER}
-  </delete>
-  <insert id="insert" keyColumn="id_" keyProperty="id" parameterType="com.ym.mec.biz.dal.entity.TenantProductInfo" useGeneratedKeys="true">
-    insert into tenant_product_info (tenant_id_, serve_id_, serve_detail_id_, 
-      original_price_, contract_price_, pay_amount_, 
-      expiry_count_, expiry_unit_, expiry_data_
-      )
-    values (#{tenantId,jdbcType=INTEGER}, #{serveId,jdbcType=INTEGER}, #{serveDetailId,jdbcType=INTEGER}, 
-      #{originalPrice,jdbcType=DECIMAL}, #{contractPrice,jdbcType=DECIMAL}, #{payAmount,jdbcType=DECIMAL}, 
-      #{expiryCount,jdbcType=INTEGER}, #{expiryUnit,jdbcType=VARCHAR}, #{expiryData,jdbcType=DATE}
-      )
-  </insert>
-  <insert id="insertSelective" keyColumn="id_" keyProperty="id" parameterType="com.ym.mec.biz.dal.entity.TenantProductInfo" useGeneratedKeys="true">
-    insert into tenant_product_info
-    <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="tenantId != null">
-        tenant_id_,
-      </if>
-      <if test="serveId != null">
-        serve_id_,
-      </if>
-      <if test="serveDetailId != null">
-        serve_detail_id_,
-      </if>
-      <if test="originalPrice != null">
-        original_price_,
-      </if>
-      <if test="contractPrice != null">
-        contract_price_,
-      </if>
-      <if test="payAmount != null">
-        pay_amount_,
-      </if>
-      <if test="expiryCount != null">
-        expiry_count_,
-      </if>
-      <if test="expiryUnit != null">
-        expiry_unit_,
-      </if>
-      <if test="expiryData != null">
-        expiry_data_,
-      </if>
-    </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="tenantId != null">
-        #{tenantId,jdbcType=INTEGER},
-      </if>
-      <if test="serveId != null">
-        #{serveId,jdbcType=INTEGER},
-      </if>
-      <if test="serveDetailId != null">
-        #{serveDetailId,jdbcType=INTEGER},
-      </if>
-      <if test="originalPrice != null">
-        #{originalPrice,jdbcType=DECIMAL},
-      </if>
-      <if test="contractPrice != null">
-        #{contractPrice,jdbcType=DECIMAL},
-      </if>
-      <if test="payAmount != null">
-        #{payAmount,jdbcType=DECIMAL},
-      </if>
-      <if test="expiryCount != null">
-        #{expiryCount,jdbcType=INTEGER},
-      </if>
-      <if test="expiryUnit != null">
-        #{expiryUnit,jdbcType=VARCHAR},
-      </if>
-      <if test="expiryData != null">
-        #{expiryData,jdbcType=DATE},
-      </if>
-    </trim>
-  </insert>
-  <update id="updateByPrimaryKeySelective" parameterType="com.ym.mec.biz.dal.entity.TenantProductInfo">
-    update tenant_product_info
-    <set>
-      <if test="tenantId != null">
-        tenant_id_ = #{tenantId,jdbcType=INTEGER},
-      </if>
-      <if test="serveId != null">
-        serve_id_ = #{serveId,jdbcType=INTEGER},
-      </if>
-      <if test="serveDetailId != null">
-        serve_detail_id_ = #{serveDetailId,jdbcType=INTEGER},
-      </if>
-      <if test="originalPrice != null">
-        original_price_ = #{originalPrice,jdbcType=DECIMAL},
-      </if>
-      <if test="contractPrice != null">
-        contract_price_ = #{contractPrice,jdbcType=DECIMAL},
-      </if>
-      <if test="payAmount != null">
-        pay_amount_ = #{payAmount,jdbcType=DECIMAL},
-      </if>
-      <if test="expiryCount != null">
-        expiry_count_ = #{expiryCount,jdbcType=INTEGER},
-      </if>
-      <if test="expiryUnit != null">
-        expiry_unit_ = #{expiryUnit,jdbcType=VARCHAR},
-      </if>
-      <if test="expiryData != null">
-        expiry_data_ = #{expiryData,jdbcType=DATE},
-      </if>
-    </set>
-    where id_ = #{id,jdbcType=INTEGER}
-  </update>
-  <update id="updateByPrimaryKey" parameterType="com.ym.mec.biz.dal.entity.TenantProductInfo">
-    update tenant_product_info
-    set tenant_id_ = #{tenantId,jdbcType=INTEGER},
-      serve_id_ = #{serveId,jdbcType=INTEGER},
-      serve_detail_id_ = #{serveDetailId,jdbcType=INTEGER},
-      original_price_ = #{originalPrice,jdbcType=DECIMAL},
-      contract_price_ = #{contractPrice,jdbcType=DECIMAL},
-      pay_amount_ = #{payAmount,jdbcType=DECIMAL},
-      expiry_count_ = #{expiryCount,jdbcType=INTEGER},
-      expiry_unit_ = #{expiryUnit,jdbcType=VARCHAR},
-      expiry_data_ = #{expiryData,jdbcType=DATE}
-    where id_ = #{id,jdbcType=INTEGER}
-  </update>
+
 </mapper>

+ 6 - 14
mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java

@@ -1,8 +1,8 @@
 package com.ym.mec.web.controller;
 
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.ym.mec.biz.dal.dao.MusicGroupSchoolTermCourseDetailDao;
-import com.ym.mec.biz.dal.dao.TenantInfoDao;
 import com.ym.mec.biz.dal.entity.MusicGroupSchoolTermCourseDetail;
 import com.ym.mec.biz.dal.entity.TenantInfo;
 import com.ym.mec.biz.dal.enums.IndexDataType;
@@ -105,7 +105,7 @@ public class TaskController extends BaseController {
 	@Autowired
 	private SysMusicCompareRecordService sysMusicCompareRecordService;
 	@Autowired
-	private TenantInfoDao tenantInfoDao;
+	private TenantInfoService tenantInfoService;
 
 	@GetMapping(value = "/syncImHistoryMessageTask")
 	// 同步即时通讯聊天记录
@@ -152,9 +152,7 @@ public class TaskController extends BaseController {
 	@GetMapping(value = "/repertoryWarn")
 	// 商品库存预警
 	public void repertoryWarn(){
-		Map<String,Object> paramMap = new HashMap<>(1);
-		paramMap.put("state",1);
-		List<TenantInfo> tenantInfos = tenantInfoDao.queryList(paramMap);
+		List<TenantInfo> tenantInfos = tenantInfoService.list(new QueryWrapper<TenantInfo>().eq("state_",1));
 		if(tenantInfos != null && tenantInfos.size() > 0){
 			for (TenantInfo tenantInfo : tenantInfos) {
 				goodsService.repertoryWarn(tenantInfo.getId());
@@ -183,9 +181,7 @@ public class TaskController extends BaseController {
 	@GetMapping("/vipGroupTeacherSalarySettlement")
 	// vip课课酬结算
 	public void vipGroupTeacherSalarySettlement() {
-		Map<String,Object> paramMap = new HashMap<>(1);
-		paramMap.put("state",1);
-		List<TenantInfo> tenantInfos = tenantInfoDao.queryList(paramMap);
+        List<TenantInfo> tenantInfos = tenantInfoService.list(new QueryWrapper<TenantInfo>().eq("state_",1));
 		if(tenantInfos != null && tenantInfos.size() > 0){
 			for (TenantInfo tenantInfo : tenantInfos) {
 				courseScheduleTeacherSalaryService.teacherSalarySettlement(tenantInfo.getId());
@@ -198,9 +194,7 @@ public class TaskController extends BaseController {
 	@GetMapping("/practiceTeacherSalarySettlement")
 	// 陪练课课酬结算
 	public void practiceTeacherSalarySettlement() {
-		Map<String,Object> paramMap = new HashMap<>(1);
-		paramMap.put("state",1);
-		List<TenantInfo> tenantInfos = tenantInfoDao.queryList(paramMap);
+        List<TenantInfo> tenantInfos = tenantInfoService.list(new QueryWrapper<TenantInfo>().eq("state_",1));
 		if(tenantInfos != null && tenantInfos.size() > 0){
 			for (TenantInfo tenantInfo : tenantInfos) {
 				courseScheduleTeacherSalaryService.practiceTeacherSalarySettlement(tenantInfo.getId());
@@ -213,9 +207,7 @@ public class TaskController extends BaseController {
 	// 乐团课课酬结算
 	@GetMapping("/musicGroupTeacherSalarySettlement")
 	public void musicGroupTeacherSalarySettlement() {
-		Map<String,Object> paramMap = new HashMap<>(1);
-		paramMap.put("state",1);
-		List<TenantInfo> tenantInfos = tenantInfoDao.queryList(paramMap);
+        List<TenantInfo> tenantInfos = tenantInfoService.list(new QueryWrapper<TenantInfo>().eq("state_",1));
 		if(tenantInfos != null && tenantInfos.size() > 0){
 			for (TenantInfo tenantInfo : tenantInfos) {
 				courseScheduleTeacherSalaryService.musicGroupTeacherSalarySettlement(tenantInfo.getId());