yanite 3 年之前
父節點
當前提交
c67d72d253

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysEmailDao.java

@@ -15,6 +15,7 @@ import java.util.List;
 public interface SysEmailDao extends BaseMapper<SysEmail> {
 
    int insertBatch(@Param("entities") List<SysEmail> entities);
-   
+
+    SysEmail query();
 }
 

+ 1 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/SysEmailService.java

@@ -11,5 +11,6 @@ import com.ym.mec.biz.dal.entity.SysEmail;
  */
 public interface SysEmailService extends IService<SysEmail> {
 
+    SysEmail query();
 }
 

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysEmailServiceImpl.java

@@ -21,5 +21,9 @@ public class SysEmailServiceImpl extends ServiceImpl<SysEmailDao, SysEmail> impl
     private final static Logger logger = LoggerFactory.getLogger(SysEmailServiceImpl.class);
 
 
+    @Override
+    public SysEmail query() {
+        return baseMapper.query();
+    }
 }
 

+ 27 - 22
mec-biz/src/main/resources/config/mybatis/SysEmailMapper.xml

@@ -1,28 +1,33 @@
 <?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="com.ym.mec.biz.dal.dao.SysEmailDao">
-  <resultMap id="BaseResultMap" type="com.ym.mec.biz.dal.entity.SysEmail">
-                       <id column="id_" jdbcType="INTEGER" property="id"/>
-                                  <result column="host_name_" jdbcType="VARCHAR" property="hostName"/>
-                                  <result column="smtp_port_" jdbcType="INTEGER" property="smtpPort"/>
-                                  <result column="user_name_" jdbcType="VARCHAR" property="userName"/>
-                                  <result column="password_" jdbcType="VARCHAR" property="password"/>
-                                  <result column="from_" jdbcType="VARCHAR" property="from"/>
-                                  <result column="from_name_" jdbcType="VARCHAR" property="fromName"/>
-                                  <result column="tenant_id_" jdbcType="INTEGER" property="tenantId"/>
-                </resultMap>
-  
-  <sql id="Base_Column_List">    
-                                            id_, host_name_, smtp_port_, user_name_, password_, from_, from_name_, tenant_id_
-  </sql>
-  
-   <insert id="insertBatch" keyColumn="id_" keyProperty="id" useGeneratedKeys="true"
+    <resultMap id="BaseResultMap" type="com.ym.mec.biz.dal.entity.SysEmail">
+        <id column="id_" jdbcType="INTEGER" property="id"/>
+        <result column="host_name_" jdbcType="VARCHAR" property="hostName"/>
+        <result column="smtp_port_" jdbcType="INTEGER" property="smtpPort"/>
+        <result column="user_name_" jdbcType="VARCHAR" property="userName"/>
+        <result column="password_" jdbcType="VARCHAR" property="password"/>
+        <result column="from_" jdbcType="VARCHAR" property="from"/>
+        <result column="from_name_" jdbcType="VARCHAR" property="fromName"/>
+        <result column="tenant_id_" jdbcType="INTEGER" property="tenantId"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id_, host_name_, smtp_port_, user_name_, password_, from_, from_name_, tenant_id_
+    </sql>
+
+    <insert id="insertBatch" keyColumn="id_" keyProperty="id" useGeneratedKeys="true"
             parameterType="com.ym.mec.biz.dal.entity.SysEmail">
-       insert into sys_email(host_name_, smtp_port_, user_name_, password_, from_, from_name_, tenant_id_)
-       values
-       <foreach collection="entities" item="entity" separator=",">
-       (#{entity.hostName}, #{entity.smtpPort}, #{entity.userName}, #{entity.password}, #{entity.from}, #{entity.fromName}, #{entity.tenantId})
-       </foreach>
-   </insert>
+        insert into sys_email(host_name_, smtp_port_, user_name_, password_, from_, from_name_, tenant_id_)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+            (#{entity.hostName}, #{entity.smtpPort}, #{entity.userName}, #{entity.password}, #{entity.from},
+            #{entity.fromName}, #{entity.tenantId})
+        </foreach>
+    </insert>
+    <select id="query" resultType="com.ym.mec.biz.dal.entity.SysEmail">
+        select *
+        from sys_email
+    </select>
 
 </mapper>

+ 3 - 1
mec-biz/src/main/resources/config/mybatis/TenantOrderRecordMapper.xml

@@ -54,7 +54,9 @@
                 LEFT JOIN tenant_info AS b
                           ON a.tenant_id_ = b.id_
     <where>
-        a.tenant_id_ = #{tenantId}
+        <if test="param.tenantId != null">
+            a.tenant_id_ = #{param.tenantId}
+        </if>
         <if test="param.orderNo != null ">
             AND a.`order_no_` = #{param.orderNo}
         </if>

+ 22 - 3
mec-web/src/main/java/com/ym/mec/web/controller/SysEmailController.java

@@ -1,9 +1,11 @@
 package com.ym.mec.web.controller;
 
-
-
 import com.ym.mec.biz.dal.entity.SysEmail;
 import com.ym.mec.biz.service.SysEmailService;
+import com.ym.mec.common.entity.HttpResponseResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 import com.ym.mec.common.controller.BaseController;
 
@@ -16,7 +18,8 @@ import javax.annotation.Resource;
  * @since 2022-01-04 17:07:43
  */
 @RestController
-@RequestMapping("/sysEmail")
+@Api(tags = "系统邮件服务")
+@RequestMapping("sysEmail")
 public class SysEmailController extends BaseController {
     /**
      * 服务对象
@@ -24,5 +27,21 @@ public class SysEmailController extends BaseController {
     @Resource
     private SysEmailService sysEmailService;
 
+
+    @ApiOperation(value = "修改")
+    @PostMapping("/update")
+    @PreAuthorize("@pcs.hasPermissions('sysEmail/update')")
+    public HttpResponseResult<SysEmail> update(@RequestBody SysEmail sysEmail) {
+        sysEmailService.updateById(sysEmail);
+        return succeed(sysEmail);
+    }
+
+    @ApiOperation(value = "查询")
+    @GetMapping("/query")
+    @PreAuthorize("@pcs.hasPermissions('sysEmail/query')")
+    public HttpResponseResult<SysEmail> query() {
+        return succeed(sysEmailService.query());
+    }
+
 }