feat():个人理解创建4个模块代码的引擎库

master
Saisai Liu 2024-05-04 15:29:53 +08:00
parent d4ac304b07
commit e10817cb1b
10 changed files with 266 additions and 139 deletions

View File

@ -1,26 +1,43 @@
package com.muyu.engine.domain; package com.muyu.engine.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.muyu.common.core.annotation.Excel; import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.BaseEntity; import com.muyu.common.core.web.domain.BaseEntity;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.function.Supplier;
/** /**
* scope * scope
* *
* @author Saisai * @author Saisai
* @date 2024-05-03 * @date 2024-05-03
*/ */
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
public class Scope extends BaseEntity public class Scope extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 主键 */ /** 主键 */
@TableId(value = "id",type = IdType.AUTO)
private Long id; private Long id;
/** 引擎id */ /** 引擎id */
@Excel(name = "引擎id") @Excel(name = "引擎id")
private Long ruleEnginId; private Long ruleEngineId;
/** 类型 */ /** 类型 */
@Excel(name = "类型") @Excel(name = "类型")
@ -34,65 +51,17 @@ public class Scope extends BaseEntity
@Excel(name = "编码") @Excel(name = "编码")
private String code; private String code;
public void setId(Long id) public static List<Scope> list(Long id, Supplier<String> username) {
{ Scope scopetaskContext = new Scope() {{setType("任务");setValue("taskContext");setRuleEngineId(id);setCreateBy(username.get());setCreateTime(new Date());}};
this.id = id; Scope scoperecordContext = new Scope() {{setType("资产集");setValue("recordContext");setRuleEngineId(id);setCreateBy(username.get());setCreateTime(new Date());}};
} Scope scopedataSetContext = new Scope() {{setType("资产记录");setValue("dataSetContext");setRuleEngineId(id);setCreateBy(username.get());setCreateTime(new Date());}};
Scope scopedataModelContext = new Scope() {{setType("资产模型");setValue("dataModelContext");setRuleEngineId(id);setCreateBy(username.get());setCreateTime(new Date());}};
public Long getId() List<Scope> scopes = new ArrayList<>() {{
{ add(scopetaskContext);
return id; add(scoperecordContext);
} add(scopedataSetContext);
public void setRuleEnginId(Long ruleEnginId) add(scopedataModelContext);
{ }};
this.ruleEnginId = ruleEnginId; return scopes;
}
public Long getRuleEnginId()
{
return ruleEnginId;
}
public void setType(String type)
{
this.type = type;
}
public String getType()
{
return type;
}
public void setValue(String value)
{
this.value = value;
}
public String getValue()
{
return value;
}
public void setCode(String code)
{
this.code = code;
}
public String getCode()
{
return code;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("ruleEnginId", getRuleEnginId())
.append("type", getType())
.append("value", getValue())
.append("code", getCode())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
} }
} }

View File

@ -12,7 +12,6 @@ import com.muyu.engine.service.RuleEngineService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
@ -24,8 +23,7 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/engine") @RequestMapping("/engine")
public class RuleEngineController extends BaseController public class RuleEngineController extends BaseController {
{
@Autowired @Autowired
private RuleEngineService ruleEngineService; private RuleEngineService ruleEngineService;
@ -34,8 +32,7 @@ public class RuleEngineController extends BaseController
*/ */
@RequiresPermissions("engine:engine:list") @RequiresPermissions("engine:engine:list")
@GetMapping("/list") @GetMapping("/list")
public Result<TableDataInfo<RuleEngine>> list(RuleEngine ruleEngine) public Result<TableDataInfo<RuleEngine>> list(RuleEngine ruleEngine) {
{
startPage(); startPage();
List<RuleEngine> list = ruleEngineService.selectRuleEngineList(ruleEngine); List<RuleEngine> list = ruleEngineService.selectRuleEngineList(ruleEngine);
return getDataTable(list); return getDataTable(list);
@ -47,8 +44,7 @@ public class RuleEngineController extends BaseController
@RequiresPermissions("engine:engine:export") @RequiresPermissions("engine:engine:export")
@Log(title = "规则引擎", businessType = BusinessType.EXPORT) @Log(title = "规则引擎", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, RuleEngine ruleEngine) public void export(HttpServletResponse response, RuleEngine ruleEngine) {
{
List<RuleEngine> list = ruleEngineService.selectRuleEngineList(ruleEngine); List<RuleEngine> list = ruleEngineService.selectRuleEngineList(ruleEngine);
ExcelUtil<RuleEngine> util = new ExcelUtil<RuleEngine>(RuleEngine.class); ExcelUtil<RuleEngine> util = new ExcelUtil<RuleEngine>(RuleEngine.class);
util.exportExcel(response, list, "规则引擎数据"); util.exportExcel(response, list, "规则引擎数据");
@ -59,8 +55,7 @@ public class RuleEngineController extends BaseController
*/ */
@RequiresPermissions("engine:engine:query") @RequiresPermissions("engine:engine:query")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public Result getInfo(@PathVariable("id") Long id) public Result getInfo(@PathVariable("id") Long id) {
{
return success(ruleEngineService.selectRuleEngineById(id)); return success(ruleEngineService.selectRuleEngineById(id));
} }
@ -70,8 +65,7 @@ public class RuleEngineController extends BaseController
@RequiresPermissions("engine:engine:add") @RequiresPermissions("engine:engine:add")
@Log(title = "规则引擎", businessType = BusinessType.INSERT) @Log(title = "规则引擎", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public Result add(@RequestBody RuleEngine ruleEngine) public Result add(@RequestBody RuleEngine ruleEngine) {
{
return toAjax(ruleEngineService.insertRuleEngine(ruleEngine)); return toAjax(ruleEngineService.insertRuleEngine(ruleEngine));
} }
@ -81,8 +75,7 @@ public class RuleEngineController extends BaseController
@RequiresPermissions("engine:engine:edit") @RequiresPermissions("engine:engine:edit")
@Log(title = "规则引擎", businessType = BusinessType.UPDATE) @Log(title = "规则引擎", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public Result edit(@RequestBody RuleEngine ruleEngine) public Result edit(@RequestBody RuleEngine ruleEngine) {
{
return toAjax(ruleEngineService.updateRuleEngine(ruleEngine)); return toAjax(ruleEngineService.updateRuleEngine(ruleEngine));
} }
@ -92,21 +85,9 @@ public class RuleEngineController extends BaseController
@RequiresPermissions("engine:engine:remove") @RequiresPermissions("engine:engine:remove")
@Log(title = "规则引擎", businessType = BusinessType.DELETE) @Log(title = "规则引擎", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public Result remove(@PathVariable Long[] ids) public Result remove(@PathVariable Long[] ids) {
{
return toAjax(ruleEngineService.deleteRuleEngineByIds(ids)); return toAjax(ruleEngineService.deleteRuleEngineByIds(ids));
} }
/**
*
*/
@RequiresPermissions("engine:engine:testRuleEngine")
@Log(title = "规则引擎", businessType = BusinessType.DELETE)
@DeleteMapping("testRuleEngine/{id}")
public Result testRuleEngine(@PathVariable Long id) throws ServletException {
return toAjax(ruleEngineService.testRuleEngine(id));
}
} }

View File

@ -0,0 +1,122 @@
package com.muyu.engine.controller;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.utils.poi.ExcelUtil;
import com.muyu.common.core.web.controller.BaseController;
import com.muyu.common.core.web.page.TableDataInfo;
import com.muyu.common.log.annotation.Log;
import com.muyu.common.log.enums.BusinessType;
import com.muyu.common.security.annotation.RequiresPermissions;
import com.muyu.engine.domain.Scope;
import com.muyu.engine.service.ScopeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* Controller
*
* @author Saisai
* @date 2024-05-03
*/
@RestController
@RequestMapping("/scope")
public class ScopeController extends BaseController
{
@Autowired
private ScopeService scopeService;
/**
*
*/
@RequiresPermissions("engine:scope:list")
@GetMapping("/list")
public Result<TableDataInfo<Scope>> list(Scope scope)
{
startPage();
List<Scope> list = scopeService.selectScopeList(scope);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("engine:scope:export")
@Log(title = "规则引擎代码", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Scope scope)
{
List<Scope> list = scopeService.selectScopeList(scope);
ExcelUtil<Scope> util = new ExcelUtil<Scope>(Scope.class);
util.exportExcel(response, list, "规则引擎代码数据");
}
/**
*
*/
@RequiresPermissions("engine:scope:query")
@GetMapping(value = "/{id}")
public Result getInfo(@PathVariable("id") Long id)
{
return success(scopeService.selectScopeById(id));
}
/**
*
*/
@RequiresPermissions("engine:scope:add")
@Log(title = "规则引擎代码", businessType = BusinessType.INSERT)
@PostMapping
public Result add(@RequestBody Scope scope)
{
return toAjax(scopeService.insertScope(scope));
}
/**
*
*/
@RequiresPermissions("engine:scope:edit")
@Log(title = "规则引擎代码", businessType = BusinessType.UPDATE)
@PutMapping
public Result edit(@RequestBody Scope scope)
{
return toAjax(scopeService.updateScope(scope));
}
/**
*
*/
@RequiresPermissions("engine:scope:remove")
@Log(title = "规则引擎代码", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public Result remove(@PathVariable Long[] ids)
{
return toAjax(scopeService.deleteScopeByIds(ids));
}
/**
*
*/
@RequiresPermissions("engine:scope:init")
@Log(title = "规则引擎", businessType = BusinessType.DELETE)
@GetMapping("init/{id}")
public Result init(@PathVariable Long id) throws ServletException {
return toAjax(scopeService.init(id));
}
/**
*
*/
@RequiresPermissions("engine:scope:test")
@Log(title = "规则引擎", businessType = BusinessType.DELETE)
@GetMapping("test/{id}")
public Result test(@PathVariable Long id) throws ServletException {
return toAjax(scopeService.test(id));
}
}

View File

@ -62,10 +62,5 @@ public interface RuleEngineService extends IService<RuleEngine>
*/ */
public int deleteRuleEngineById(Long id); public int deleteRuleEngineById(Long id);
/**
*
* @param id
* @return
*/
boolean testRuleEngine(Long id) throws ServletException;
} }

View File

@ -5,6 +5,8 @@ import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.engine.domain.Scope; import com.muyu.engine.domain.Scope;
import javax.servlet.ServletException;
/** /**
* Service * Service
* *
@ -60,4 +62,15 @@ public interface ScopeService extends IService<Scope>
* @return * @return
*/ */
public int deleteScopeById(Long id); public int deleteScopeById(Long id);
/**
*
* @param id
* @return
*/
boolean init(Long id) throws ServletException;
void deleteScopeByRuleIds(Long[] ids);
boolean test(Long id) throws ServletException;
} }

View File

@ -1,19 +1,18 @@
package com.muyu.engine.service.impl; package com.muyu.engine.service.impl;
import com.alibaba.nacos.shaded.com.google.common.base.Supplier;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.common.core.utils.DateUtils; import com.muyu.common.core.utils.DateUtils;
import com.muyu.common.security.utils.SecurityUtils;
import com.muyu.engine.domain.RuleEngine; import com.muyu.engine.domain.RuleEngine;
import com.muyu.engine.domain.Scope;
import com.muyu.engine.mapper.RuleEngineMapper; import com.muyu.engine.mapper.RuleEngineMapper;
import com.muyu.engine.service.RuleEngineService; import com.muyu.engine.service.RuleEngineService;
import com.muyu.engine.service.ScopeService;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.ServletException;
import java.io.File;
import java.util.List; import java.util.List;
import java.util.concurrent.Callable;
/** /**
* Service * Service
@ -27,7 +26,8 @@ public class RuleEngineServiceImpl extends ServiceImpl<RuleEngineMapper,RuleEngi
{ {
@Autowired @Autowired
private RuleEngineMapper ruleEngineMapper; private RuleEngineMapper ruleEngineMapper;
@Autowired
private ScopeService scopeService;
/** /**
* *
* *
@ -62,7 +62,11 @@ public class RuleEngineServiceImpl extends ServiceImpl<RuleEngineMapper,RuleEngi
public int insertRuleEngine(RuleEngine ruleEngine) public int insertRuleEngine(RuleEngine ruleEngine)
{ {
ruleEngine.setCreateTime(DateUtils.getNowDate()); ruleEngine.setCreateTime(DateUtils.getNowDate());
return ruleEngineMapper.insertRuleEngine(ruleEngine); boolean save = this.save(ruleEngine);
if (save){
scopeService.saveBatch(Scope.list(ruleEngine.getId(), SecurityUtils::getUsername));
}
return 1;
} }
/** /**
@ -87,6 +91,7 @@ public class RuleEngineServiceImpl extends ServiceImpl<RuleEngineMapper,RuleEngi
@Override @Override
public int deleteRuleEngineByIds(Long[] ids) public int deleteRuleEngineByIds(Long[] ids)
{ {
scopeService.deleteScopeByRuleIds(ids);
return ruleEngineMapper.deleteRuleEngineByIds(ids); return ruleEngineMapper.deleteRuleEngineByIds(ids);
} }
@ -102,32 +107,6 @@ public class RuleEngineServiceImpl extends ServiceImpl<RuleEngineMapper,RuleEngi
return ruleEngineMapper.deleteRuleEngineById(id); return ruleEngineMapper.deleteRuleEngineById(id);
} }
/**
*
* @param id
* @return
*/
@Override
public boolean testRuleEngine(Long id) throws ServletException {
RuleEngine ruleEngine = this.getById(id);
if (ruleEngine.getIsActivate().contains("no"))throw new ServletException("未激活");
if (ruleEngine.getStatus().contains("0"))throw new ServletException("已停用");
Supplier<Boolean> booleanSupplier = () -> {
try {
return testEngine(ruleEngine).booleanValue();
} catch (ServletException e) {
log.error(e.getMessage());
throw new RuntimeException(e);
}
};
System.out.println();
return booleanSupplier.get();
}
private Boolean testEngine(RuleEngine ruleEngine) throws ServletException {
// new File(ruleEngine);
// if (false)throw new ServletException("不存在");
return true;
}
} }

View File

@ -1,9 +1,17 @@
package com.muyu.engine.service.impl; package com.muyu.engine.service.impl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import com.alibaba.nacos.shaded.com.google.common.base.Supplier;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.common.core.text.Convert;
import com.muyu.common.core.utils.DateUtils; import com.muyu.common.core.utils.DateUtils;
import com.muyu.engine.domain.RuleEngine;
import com.muyu.engine.service.RuleEngineService;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -11,6 +19,8 @@ import com.muyu.engine.mapper.ScopeMapper;
import com.muyu.engine.domain.Scope; import com.muyu.engine.domain.Scope;
import com.muyu.engine.service.ScopeService; import com.muyu.engine.service.ScopeService;
import javax.servlet.ServletException;
/** /**
* Service * Service
* *
@ -23,6 +33,8 @@ public class ScopeServiceImpl extends ServiceImpl<ScopeMapper,Scope> implements
{ {
@Autowired @Autowired
private ScopeMapper scopeMapper; private ScopeMapper scopeMapper;
@Autowired
private RuleEngineService ruleEngineService;
/** /**
* *
@ -71,7 +83,12 @@ public class ScopeServiceImpl extends ServiceImpl<ScopeMapper,Scope> implements
public int updateScope(Scope scope) public int updateScope(Scope scope)
{ {
scope.setUpdateTime(DateUtils.getNowDate()); scope.setUpdateTime(DateUtils.getNowDate());
return scopeMapper.updateScope(scope); Scope one = this.getOne(new LambdaQueryWrapper<>() {{
eq(Scope::getValue, scope.getValue());
eq(Scope::getRuleEngineId, scope.getRuleEngineId());
}});
one.setCode(scope.getCode());
return scopeMapper.updateScope(one);
} }
/** /**
@ -97,4 +114,53 @@ public class ScopeServiceImpl extends ServiceImpl<ScopeMapper,Scope> implements
{ {
return scopeMapper.deleteScopeById(id); return scopeMapper.deleteScopeById(id);
} }
@Override
public void deleteScopeByRuleIds(Long[] ids) {
List<Long> longs = new ArrayList<>();
for (Long id : ids) {
List<Long> list = this.list(new LambdaQueryWrapper<Scope>() {{
eq(Scope::getRuleEngineId, id);
}}).stream().map(Scope::getId).toList();
longs.addAll(list);
} }
if (!longs.isEmpty()){
this.deleteScopeByIds(longs.toArray(Long[]::new));
}
}
@Override
public boolean test(Long id) throws ServletException {
return false;
}
/**
*
* @param id
* @return
*/
@Override
public boolean init(Long id) throws ServletException {
RuleEngine ruleEngine = ruleEngineService.getById(id);
if (ruleEngine.getIsActivate().contains("no"))throw new ServletException("未激活");
if (ruleEngine.getStatus().contains("1"))throw new ServletException("已停用");
Supplier<Boolean> booleanSupplier = () -> {
try {
return testEngine(ruleEngine);
} catch (ServletException e) {
log.error(e.getMessage());
throw new RuntimeException(e);
}
};
System.out.println();
return booleanSupplier.get();
}
private Boolean testEngine(RuleEngine ruleEngine) throws ServletException {
System.out.println("初始化");
System.out.println(ruleEngine);
if(false)throw new ServletException("读取异常");
return true;
}
}

View File

@ -23,6 +23,8 @@ spring:
# 共享配置 # 共享配置
shared-configs: shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
main:
allow-circular-references: true
logging: logging:
level: level:
com.muyu.etl.mapper: DEBUG com.muyu.engine.mapper: DEBUG

View File

@ -11,7 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="level" column="level" /> <result property="level" column="level" />
<result property="code" column="code" /> <result property="code" column="code" />
<result property="description" column="description" /> <result property="description" column="description" />
<result property="isActivate" column="isActivate" /> <result property="isActivate" column="is_activate" />
<result property="status" column="status" /> <result property="status" column="status" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
@ -21,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectRuleEngineVo"> <sql id="selectRuleEngineVo">
select id, name, type, level, code,description, isActivate, status, remark, create_by, create_time, update_by, update_time from rule_engine select id, name, type, level, code,description, is_activate, status, remark, create_by, create_time, update_by, update_time from rule_engine
</sql> </sql>
<select id="selectRuleEngineList" parameterType="com.muyu.engine.domain.RuleEngine" resultMap="RuleEngineResult"> <select id="selectRuleEngineList" parameterType="com.muyu.engine.domain.RuleEngine" resultMap="RuleEngineResult">
@ -32,7 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="level != null and level != ''"> and level = #{level}</if> <if test="level != null and level != ''"> and level = #{level}</if>
<if test="code != null and code != ''"> and code = #{code}</if> <if test="code != null and code != ''"> and code = #{code}</if>
<if test="description != null and description != ''"> and description = #{description}</if> <if test="description != null and description != ''"> and description = #{description}</if>
<if test="isActivate != null and isActivate != ''"> and isActivate = #{isActivate}</if> <if test="isActivate != null and isActivate != ''"> and is_activate = #{isActivate}</if>
<if test="status != null and status != ''"> and status = #{status}</if> <if test="status != null and status != ''"> and status = #{status}</if>
</where> </where>
</select> </select>
@ -51,7 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="level != null">level,</if> <if test="level != null">level,</if>
<if test="code != null">code,</if> <if test="code != null">code,</if>
<if test="description != null">description,</if> <if test="description != null">description,</if>
<if test="isActivate != null">isActivate,</if> <if test="isActivate != null">is_activate,</if>
<if test="status != null">status,</if> <if test="status != null">status,</if>
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
@ -84,7 +84,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="level != null">level = #{level},</if> <if test="level != null">level = #{level},</if>
<if test="code != null">code = #{code},</if> <if test="code != null">code = #{code},</if>
<if test="description != null">description = #{description},</if> <if test="description != null">description = #{description},</if>
<if test="isActivate != null">isActivate = #{isActivate},</if> <if test="isActivate != null">is_activate = #{isActivate},</if>
<if test="status != null">status = #{status},</if> <if test="status != null">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if> <if test="createBy != null">create_by = #{createBy},</if>

View File

@ -6,7 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="com.muyu.engine.domain.Scope" id="ScopeResult"> <resultMap type="com.muyu.engine.domain.Scope" id="ScopeResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="ruleEnginId" column="ruleEnginId" /> <result property="ruleEngineId" column="rule_engine_id" />
<result property="type" column="type" /> <result property="type" column="type" />
<result property="value" column="value" /> <result property="value" column="value" />
<result property="code" column="code" /> <result property="code" column="code" />
@ -18,13 +18,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectScopeVo"> <sql id="selectScopeVo">
select id, ruleEnginId, type, value, code, remark, create_by, create_time, update_by, update_time from scope select id, rule_engine_id, type, value, code, remark, create_by, create_time, update_by, update_time from scope
</sql> </sql>
<select id="selectScopeList" parameterType="com.muyu.engine.domain.Scope" resultMap="ScopeResult"> <select id="selectScopeList" parameterType="com.muyu.engine.domain.Scope" resultMap="ScopeResult">
<include refid="selectScopeVo"/> <include refid="selectScopeVo"/>
<where> <where>
<if test="ruleEnginId != null "> and ruleEnginId = #{ruleEnginId}</if> <if test="ruleEngineId != null "> and rule_engine_id = #{ruleEngineId}</if>
<if test="type != null and type != ''"> and type = #{type}</if> <if test="type != null and type != ''"> and type = #{type}</if>
<if test="value != null and value != ''"> and value = #{value}</if> <if test="value != null and value != ''"> and value = #{value}</if>
<if test="code != null and code != ''"> and code = #{code}</if> <if test="code != null and code != ''"> and code = #{code}</if>
@ -40,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into scope insert into scope
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if> <if test="id != null">id,</if>
<if test="ruleEnginId != null">ruleEnginId,</if> <if test="ruleEngineId != null">rule_engine_id,</if>
<if test="type != null">type,</if> <if test="type != null">type,</if>
<if test="value != null">value,</if> <if test="value != null">value,</if>
<if test="code != null">code,</if> <if test="code != null">code,</if>
@ -52,7 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if> <if test="id != null">#{id},</if>
<if test="ruleEnginId != null">#{ruleEnginId},</if> <if test="ruleEngineId != null">#{ruleEngineId},</if>
<if test="type != null">#{type},</if> <if test="type != null">#{type},</if>
<if test="value != null">#{value},</if> <if test="value != null">#{value},</if>
<if test="code != null">#{code},</if> <if test="code != null">#{code},</if>
@ -67,7 +67,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateScope" parameterType="com.muyu.engine.domain.Scope"> <update id="updateScope" parameterType="com.muyu.engine.domain.Scope">
update scope update scope
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="ruleEnginId != null">ruleEnginId = #{ruleEnginId},</if> <if test="ruleEngineId != null">rule_engine_id = #{ruleEngineId},</if>
<if test="type != null">type = #{type},</if> <if test="type != null">type = #{type},</if>
<if test="value != null">value = #{value},</if> <if test="value != null">value = #{value},</if>
<if test="code != null">code = #{code},</if> <if test="code != null">code = #{code},</if>