feat: 解决mybatis-flex和mybatis sql 冲突问题

This commit is contained in:
landaiqing
2024-06-02 03:05:05 +08:00
parent b15a929bb9
commit bb74574bc3
13 changed files with 13 additions and 161 deletions

View File

@@ -43,14 +43,6 @@ public interface SchisandraAuthPermissionDao extends BaseMapper<SchisandraAuthPe
*/ */
long count(SchisandraAuthPermission schisandraAuthPermission); long count(SchisandraAuthPermission schisandraAuthPermission);
/**
* 新增数据
*
* @param schisandraAuthPermission 实例对象
* @return 影响行数
*/
int insert(SchisandraAuthPermission schisandraAuthPermission);
/** /**
* 批量新增数据MyBatis原生foreach方法 * 批量新增数据MyBatis原生foreach方法
* *
@@ -68,21 +60,7 @@ public interface SchisandraAuthPermissionDao extends BaseMapper<SchisandraAuthPe
*/ */
int insertOrUpdateBatch(@Param("entities") List<SchisandraAuthPermission> entities); int insertOrUpdateBatch(@Param("entities") List<SchisandraAuthPermission> entities);
/**
* 修改数据
*
* @param schisandraAuthPermission 实例对象
* @return 影响行数
*/
int update(SchisandraAuthPermission schisandraAuthPermission);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Long id);
} }

View File

@@ -43,13 +43,6 @@ public interface SchisandraAuthRoleDao extends BaseMapper<SchisandraAuthRole> {
*/ */
long count(SchisandraAuthRole schisandraAuthRole); long count(SchisandraAuthRole schisandraAuthRole);
/**
* 新增数据
*
* @param schisandraAuthRole 实例对象
* @return 影响行数
*/
int insert(SchisandraAuthRole schisandraAuthRole);
/** /**
* 批量新增数据MyBatis原生foreach方法 * 批量新增数据MyBatis原生foreach方法
@@ -68,21 +61,8 @@ public interface SchisandraAuthRoleDao extends BaseMapper<SchisandraAuthRole> {
*/ */
int insertOrUpdateBatch(@Param("entities") List<SchisandraAuthRole> entities); int insertOrUpdateBatch(@Param("entities") List<SchisandraAuthRole> entities);
/**
* 修改数据
*
* @param schisandraAuthRole 实例对象
* @return 影响行数
*/
int update(SchisandraAuthRole schisandraAuthRole);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Long id);
} }

View File

@@ -64,7 +64,7 @@ public class SchisandraAuthRolePermission implements Serializable {
/** /**
* *
*/ */
@Column("is_deleted") @Column(value = "is_deleted",isLogicDelete = true)
private Integer isDeleted; private Integer isDeleted;
} }

View File

@@ -1,12 +1,12 @@
package com.schisandra.auth.infra.basic.service.impl; package com.schisandra.auth.infra.basic.service.impl;
import com.schisandra.auth.infra.basic.entity.SchisandraAuthPermission;
import com.schisandra.auth.infra.basic.dao.SchisandraAuthPermissionDao; import com.schisandra.auth.infra.basic.dao.SchisandraAuthPermissionDao;
import com.schisandra.auth.infra.basic.entity.SchisandraAuthPermission;
import com.schisandra.auth.infra.basic.service.SchisandraAuthPermissionService; import com.schisandra.auth.infra.basic.service.SchisandraAuthPermissionService;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;

View File

@@ -128,11 +128,6 @@
</where> </where>
</select> </select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into schisandra_auth_permission(`name`,parent_id,`type`,menu_url,`status`,`show`,icon,permission_key,created_by,created_time,update_by,update_time,is_deleted)
values (#{name},#{parentId},#{type},#{menuUrl},#{status},#{show},#{icon},#{permissionKey},#{createdBy},#{createdTime},#{updateBy},#{updateTime},#{isDeleted})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true"> <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into insert into
@@ -157,59 +152,6 @@
values(update_time)is_deleted = values(is_deleted) values(update_time)is_deleted = values(is_deleted)
</insert> </insert>
<!--通过主键修改数据-->
<update id="update">
update schisandra_auth_permission
<set>
<if test="name != null and name != ''">
`name` = #{name},
</if>
<if test="parentId != null">
parent_id = #{parentId},
</if>
<if test="type != null">
`type` = #{type},
</if>
<if test="menuUrl != null and menuUrl != ''">
menu_url = #{menuUrl},
</if>
<if test="status != null">
`status` = #{status},
</if>
<if test="show != null">
`show` = #{show},
</if>
<if test="icon != null and icon != ''">
icon = #{icon},
</if>
<if test="permissionKey != null and permissionKey != ''">
permission_key = #{permissionKey},
</if>
<if test="createdBy != null and createdBy != ''">
created_by = #{createdBy},
</if>
<if test="createdTime != null">
created_time = #{createdTime},
</if>
<if test="updateBy != null and updateBy != ''">
update_by = #{updateBy},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="isDeleted != null">
is_deleted = #{isDeleted},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete
from schisandra_auth_permission
where id = #{id}
</delete>
</mapper> </mapper>

View File

@@ -86,11 +86,6 @@
</where> </where>
</select> </select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into schisandra_auth_role(role_name,role_key,created_by,created_time,update_by,update_time,is_deleted)
values (#{roleName},#{roleKey},#{createdBy},#{createdTime},#{updateBy},#{updateTime},#{isDeleted})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true"> <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into schisandra_auth_role(role_name,role_key,created_by,created_time,update_by,update_time,is_deleted) insert into schisandra_auth_role(role_name,role_key,created_by,created_time,update_by,update_time,is_deleted)
@@ -112,41 +107,6 @@
values(is_deleted) values(is_deleted)
</insert> </insert>
<!--通过主键修改数据-->
<update id="update">
update schisandra_auth_role
<set>
<if test="roleName != null and roleName != ''">
role_name = #{roleName},
</if>
<if test="roleKey != null and roleKey != ''">
role_key = #{roleKey},
</if>
<if test="createdBy != null and createdBy != ''">
created_by = #{createdBy},
</if>
<if test="createdTime != null">
created_time = #{createdTime},
</if>
<if test="updateBy != null and updateBy != ''">
update_by = #{updateBy},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="isDeleted != null">
is_deleted = #{isDeleted},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete
from schisandra_auth_role
where id = #{id}
</delete>
</mapper> </mapper>

View File

@@ -89,7 +89,7 @@ mybatis-flex:
deleted-value-of-logic-delete: 1 deleted-value-of-logic-delete: 1
logic-delete-column: is_deleted logic-delete-column: is_deleted
mapper-locations: mapper-locations:
- "classpath*:/mapper/**/*.xml" - "classpath*:/mapper/*.xml"
# 前端地址 # 前端地址
web: web:

View File

@@ -1,8 +1,6 @@
spring: spring:
application: application:
name: schisandra-cloud-storage-auth-dev name: schisandra-cloud-storage-auth
profiles:
active: dev
cloud: cloud:
nacos: nacos:
config: config:

View File

@@ -5,19 +5,19 @@ spring:
gateway: gateway:
routes: routes:
- id: oss - id: oss
uri: lb://schisandra-cloud-storage-oss-dev uri: lb://schisandra-cloud-storage-oss
predicates: predicates:
- Path=/oss/** - Path=/oss/**
filters: filters:
- StripPrefix=1 - StripPrefix=1
- id: auth - id: auth
uri: lb://schisandra-cloud-storage-auth-dev uri: lb://schisandra-cloud-storage-auth
predicates: predicates:
- Path=/auth/** - Path=/auth/**
filters: filters:
- StripPrefix=1 - StripPrefix=1
- id: system - id: system
uri: lb://schisandra-cloud-storage-system-dev uri: lb://schisandra-cloud-storage-system
predicates: predicates:
- Path=/system/** - Path=/system/**
filters: filters:

View File

@@ -1,8 +1,6 @@
spring: spring:
application: application:
name: schisandra-cloud-storage-gateway-dev name: schisandra-cloud-storage-gateway
profiles:
active: dev
cloud: cloud:
nacos: nacos:
config: config:

View File

@@ -1,8 +1,6 @@
spring: spring:
application: application:
name: schisandra-cloud-storage-oss-dev name: schisandra-cloud-storage-oss
profiles:
active: dev
cloud: cloud:
nacos: nacos:
config: config:

View File

@@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@FeignClient("schisandra-cloud-storage-system-dev") @FeignClient("schisandra-cloud-storage-system")
public interface SchisandraSystemFeignService { public interface SchisandraSystemFeignService {
@PostMapping(value = "/system/getConfigByKey") @PostMapping(value = "/system/getConfigByKey")
Result<SchisandraSysConfigDTO> getConfigByKey(@RequestParam(value = "key") String key); Result<SchisandraSysConfigDTO> getConfigByKey(@RequestParam(value = "key") String key);

View File

@@ -1,8 +1,6 @@
spring: spring:
application: application:
name: schisandra-cloud-storage-system-dev name: schisandra-cloud-storage-system
profiles:
active: dev
cloud: cloud:
nacos: nacos:
config: config: