master
YTD 2 years ago
parent 89c57a1280
commit 7d9a362b95
  1. 9
      ant-design-vue-jeecg/src/mixins/JeecgListMixin.js
  2. 185
      ant-design-vue-jeecg/src/views/rulex/RulexList.vue
  3. 102
      ant-design-vue-jeecg/src/views/rulex/modules/RulexForm.vue
  4. 46
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/controller/RulexController.java
  5. 6
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/mapper/RulexMapper.java
  6. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/service/IRulexService.java
  7. 20
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/service/impl/RulexServiceImpl.java

@ -283,6 +283,15 @@ export const JeecgListMixin = {
this.$refs.modalForm.title = "复制"; this.$refs.modalForm.title = "复制";
this.$refs.modalForm.disableSubmit = false; this.$refs.modalForm.disableSubmit = false;
}, },
fuzhi1: function(record){
record.id=''
record.rule_no=''
record.rule_code=''
this.$refs.modalForm.edit(record);
this.$refs.modalForm.title = "复制";
this.$refs.modalForm.disableSubmit = false;
},
handleAdd: function () { handleAdd: function () {
this.$refs.modalForm.add(); this.$refs.modalForm.add();
this.$refs.modalForm.title = "新增"; this.$refs.modalForm.title = "新增";

@ -4,6 +4,28 @@
<div class="table-page-search-wrapper"> <div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery"> <a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="规则编码">
<a-input placeholder="规则编码" v-model="queryParam.ruleCode"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="实体类型">
<j-dict-select-tag type="list" v-model="queryParam.tableId" :dictCode=table placeholder="请选择对应实体" @change="ziduan"/>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="数据字段">
<j-dict-select-tag type="list" v-model="queryParam.fieldId" :dictCode=field placeholder="请选择对应字段" />
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
</span>
</a-col>
</a-row> </a-row>
</a-form> </a-form>
</div> </div>
@ -17,13 +39,14 @@
<a-button type="primary" icon="import">导入</a-button> <a-button type="primary" icon="import">导入</a-button>
</a-upload> </a-upload>
<!-- 高级查询区域 --> <!-- 高级查询区域 -->
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> <!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>-->
<a-dropdown v-if="selectedRowKeys.length > 0"> <!-- <a-dropdown v-if="selectedRowKeys.length > 0">-->
<a-menu slot="overlay"> <!-- <a-menu slot="overlay">-->
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> <!-- <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>-->
</a-menu> <!-- </a-menu>-->
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> <!-- <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>-->
</a-dropdown> <!-- </a-dropdown>-->
<a-button @click="fanhui" type="primary" icon="rollback">返回</a-button>
</div> </div>
<!-- table区域-begin --> <!-- table区域-begin -->
@ -67,23 +90,24 @@
</a-button> </a-button>
</template> </template>
<span slot="action" slot-scope="text, record"> <span slot="action" slot-scope="text, record"v-if="role==2">
<a @click="handleDetail(record)">详情</a>
</span>
<span slot="action" slot-scope="text, record"v-if="role==1">
<a @click="fuzhi1(record)">复制</a>
<a-divider type="vertical" />
<a @click="fankui(record)">DEBUG</a>
<a-divider type="vertical" />
<a @click="handleEdit(record)">编辑</a> <a @click="handleEdit(record)">编辑</a>
<a-divider type="vertical" /> <a-divider type="vertical" />
<a-dropdown>
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
<a-menu slot="overlay">
<a-menu-item>
<a @click="handleDetail(record)">详情</a> <a @click="handleDetail(record)">详情</a>
</a-menu-item> <a-divider type="vertical" />
<a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a> <a>删除</a>
</a-popconfirm> </a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</span> </span>
</a-table> </a-table>
@ -99,7 +123,9 @@
import { mixinDevice } from '@/utils/mixin' import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin' import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import RulexModal from './modules/RulexModal' import RulexModal from './modules/RulexModal'
import {getAction} from "@api/manage";
import {filterObj} from "@/utils/util";
import store from '@/store'
export default { export default {
name: 'RulexList', name: 'RulexList',
mixins:[JeecgListMixin, mixinDevice], mixins:[JeecgListMixin, mixinDevice],
@ -122,14 +148,14 @@
} }
}, },
{ {
title:'对应模块id', title:'对应模块',
align:"center", align:"center",
dataIndex: 'moduleId' dataIndex: 'moduleId_dictText'
}, },
{ {
title:'对应功能id', title:'对应功能',
align:"center", align:"center",
dataIndex: 'functionId' dataIndex: 'functionId_dictText'
}, },
{ {
title:'规则序号', title:'规则序号',
@ -153,7 +179,7 @@
scopedSlots: {customRender: 'imgSlot'} scopedSlots: {customRender: 'imgSlot'}
}, },
{ {
title:'对应实体id', title:'对应实体',
align:"center", align:"center",
dataIndex: 'tableId_dictText' dataIndex: 'tableId_dictText'
}, },
@ -162,11 +188,6 @@
align:"center", align:"center",
dataIndex: 'fieldId_dictText' dataIndex: 'fieldId_dictText'
}, },
{
title:'责任人',
align:"center",
dataIndex: 'managerUsers'
},
{ {
title:'任务等级', title:'任务等级',
align:"center", align:"center",
@ -197,21 +218,6 @@
align:"center", align:"center",
dataIndex: 'realDuration' dataIndex: 'realDuration'
}, },
{
title:'规则状态',
align:"center",
dataIndex: 'status'
},
{
title:'版本状态',
align:"center",
dataIndex: 'verisonStatus'
},
{
title:'版本号',
align:"center",
dataIndex: 'verison'
},
{ {
title: '操作', title: '操作',
dataIndex: 'action', dataIndex: 'action',
@ -227,13 +233,25 @@
deleteBatch: "/rulex/rulex/deleteBatch", deleteBatch: "/rulex/rulex/deleteBatch",
exportXlsUrl: "/rulex/rulex/exportXls", exportXlsUrl: "/rulex/rulex/exportXls",
importExcelUrl: "rulex/rulex/importExcel", importExcelUrl: "rulex/rulex/importExcel",
loginrole:'functionx/functionx/loginrole',
}, },
dictOptions:{}, dictOptions:{},
superFieldList:[], superFieldList:[],
loadRouteType:false,
queryParam:{},
moduleid:'',
role:'',
table:'',
field:'fieldx,field_name,id',
} }
}, },
created() { created() {
let usercode = store.getters.userInfo.id
this.loginrole(usercode)
this.moduleid=this.$route.query.moduleid
this.table="tablex,table_name,id,module_id="+this.$route.query.moduleid
this.getSuperFieldList(); this.getSuperFieldList();
}, },
computed: { computed: {
@ -242,6 +260,27 @@
}, },
}, },
methods: { methods: {
ziduan(){
this.field="fieldx,field_name,id,table_id="+this.model.tableId;
},
loginrole(id){
getAction(this.url.loginrole,{id:id}).then((res)=>{
if (res.success) {
//
this.role=res.result;
}
})
},
fanhui(){
this.$router.push({
/*返回产品*/
path: '/src/views/functionx/FunctionxList',/*在引号中填写返回vue*/
query:{
moduleid:this.moduleid
}
});
},
initDictConfig(){ initDictConfig(){
}, },
getSuperFieldList(){ getSuperFieldList(){
@ -265,7 +304,63 @@
fieldList.push({type:'int',value:'verisonStatus',text:'版本状态',dictCode:''}) fieldList.push({type:'int',value:'verisonStatus',text:'版本状态',dictCode:''})
fieldList.push({type:'string',value:'verison',text:'版本号',dictCode:''}) fieldList.push({type:'string',value:'verison',text:'版本号',dictCode:''})
this.superFieldList = fieldList this.superFieldList = fieldList
} },
loadParameter() {
if (this.loadRouteType === false) {
// this.id = this.$route.query.moduleid;
// console.log("***********")
this.loadRouteType = true;
}
},
loadData(arg) {
if (!this.url.list) {
this.$message.error("请设置url.list属性!");
return
}
// 1
if (arg === 1) {
this.ipagination.current = 1;
}
this.loadParameter();
var params = this.getQueryParams();//
this.loading = true;
getAction(this.url.list, params).then((res) => {
if (res.success) {
//update-begin---author:zhangyafei Date:20201118 for------------
this.dataSource = res.result.records || res.result;
if (res.result.total) {
this.ipagination.total = res.result.total;
} else {
this.ipagination.total = 0;
}
//update-end---author:zhangyafei Date:20201118 for------------
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
},
getQueryParams() {
//
let sqp = {}
if (this.superQueryParams) {
sqp['superQueryParams'] = encodeURI(this.superQueryParams)
sqp['superQueryMatchType'] = this.superQueryMatchType
}
var param = Object.assign(sqp, this.queryParam, this.isorter, this.filters);
param.field = this.getQueryField();
param.pageNo = this.ipagination.current;
param.pageSize = this.ipagination.pageSize;
//param.id=this.id;
param.functionId = this.$route.query.functionid;
return filterObj(param);
},
searchReset() {
this.queryParam=''
this.loadData();
},
} }
} }
</script> </script>

@ -15,7 +15,7 @@
<!-- </a-col>--> <!-- </a-col>-->
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="规则序号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ruleNo"> <a-form-model-item label="规则序号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ruleNo">
<a-input v-model="model.ruleNo" placeholder="请输入规则序号" ></a-input> <a-input v-model="model.ruleNo" placeholder="请输入规则序号" disabled></a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
@ -23,74 +23,50 @@
<a-input v-model="model.ruleCode" placeholder="请输入规则编码" ></a-input> <a-input v-model="model.ruleCode" placeholder="请输入规则编码" ></a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="规则描述" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="pmDescribe"> <a-form-model-item label="对应实体" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tableId">
<a-input v-model="model.pmDescribe" placeholder="请输入规则描述" ></a-input> <j-dict-select-tag type="list" v-model="model.tableId" :dictCode=table placeholder="请选择对应实体" @change="ziduan"/>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="分析图" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="diagrams">
<j-image-upload isMultiple v-model="model.diagrams" ></j-image-upload>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="对应实体id" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tableId">
<j-dict-select-tag type="list" v-model="model.tableId" dictCode="" placeholder="请选择对应实体id" />
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="对应字段" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fieldId"> <a-form-model-item label="对应字段" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fieldId">
<j-dict-select-tag type="list" v-model="model.fieldId" dictCode="" placeholder="请选择对应字段" /> <j-dict-select-tag type="list" v-model="model.fieldId" :dictCode=field placeholder="请选择对应字段" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="责任人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="managerUsers">
<a-input v-model="model.managerUsers" placeholder="请输入责任人" ></a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<!-- <a-col :span="24">-->
<!-- <a-form-model-item label="责任人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="managerUsers">-->
<!-- <a-input v-model="model.managerUsers" placeholder="请输入责任人" ></a-input>-->
<!-- </a-form-model-item>-->
<!-- </a-col>-->
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="任务等级" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workLevel"> <a-form-model-item label="任务等级" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workLevel">
<j-dict-select-tag type="list" v-model="model.workLevel" dictCode="" placeholder="请选择任务等级" /> <j-dict-select-tag type="list" v-model="model.workLevel" dictCode="work_level" placeholder="请选择任务等级" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="任务状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workStatus">
<j-dict-select-tag type="list" v-model="model.workStatus" dictCode="" placeholder="请选择任务状态" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="开始时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="startTime">
<j-date placeholder="请选择开始时间" v-model="model.startTime" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" />
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<!-- <a-col :span="24">-->
<!-- <a-form-model-item label="任务状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workStatus">-->
<!-- <j-dict-select-tag type="list" v-model="model.workStatus" dictCode="" placeholder="请选择任务状态" />-->
<!-- </a-form-model-item>-->
<!-- </a-col>-->
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="任务时长" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="duration"> <a-form-model-item label="任务时长" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="duration">
<a-input-number v-model="model.duration" placeholder="请输入任务时长" style="width: 100%" /> <a-input-number v-model="model.duration" placeholder="请输入任务时长" style="width: 100%" />
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="提交时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="submitTime"> <a-form-model-item label="分析图" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="diagrams">
<j-date placeholder="请选择提交时间" v-model="model.submitTime" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" /> <j-image-upload isMultiple v-model="model.diagrams" ></j-image-upload>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="实际时长" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="realDuration">
<a-input-number v-model="model.realDuration" placeholder="请输入实际时长" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="规则状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="status">
<a-input-number v-model="model.status" placeholder="请输入规则状态" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="版本状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="verisonStatus">
<a-input-number v-model="model.verisonStatus" placeholder="请输入版本状态" style="width: 100%" />
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row>
<a-row>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="版本号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="verison"> <a-form-model-item label="规则描述" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="pmDescribe">
<a-input v-model="model.verison" placeholder="请输入版本号" ></a-input> <j-editor v-model="model.pmDescribe" />
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row> </a-row>
@ -119,6 +95,8 @@
data () { data () {
return { return {
model:{ model:{
ruleNo:'',
ruleCode:''
}, },
labelCol: { labelCol: {
xs: { span: 24 }, xs: { span: 24 },
@ -145,9 +123,9 @@
tableId: [ tableId: [
{ required: true, message: '请输入对应实体id!'}, { required: true, message: '请输入对应实体id!'},
], ],
fieldId: [ // fieldId: [
{ required: true, message: '请输入对应字段!'}, // { required: true, message: '!'},
], // ],
workLevel: [ workLevel: [
{ required: true, message: '请输入任务等级!'}, { required: true, message: '请输入任务等级!'},
], ],
@ -170,8 +148,11 @@
url: { url: {
add: "/rulex/rulex/add", add: "/rulex/rulex/add",
edit: "/rulex/rulex/edit", edit: "/rulex/rulex/edit",
queryById: "/rulex/rulex/queryById" queryById: "/rulex/rulex/queryById",
} sort:'/rulex/rulex/sort'
},
table:'',
field:'fieldx,field_name,id',
} }
}, },
computed: { computed: {
@ -182,10 +163,23 @@
created () { created () {
//model //model
this.model.moduleId=this.$route.query.moduleid this.model.moduleId=this.$route.query.moduleid
this.table="tablex,table_name,id,module_id="+this.model.moduleId
this.model.functionId=this.$route.query.functionid this.model.functionId=this.$route.query.functionid
this.sort()
this.modelDefault = JSON.parse(JSON.stringify(this.model)); this.modelDefault = JSON.parse(JSON.stringify(this.model));
}, },
methods: { methods: {
sort(){
getAction(this.url.sort,{id:this.model.functionId}).then((res)=>{
console.log(res)
this.model.ruleNo=res.result.substring(0,3);
this.model.ruleCode=res.result.substring(3)+this.model.ruleNo;
console.log(this.model.ruleNo)
})
},
ziduan(){
this.field="fieldx,field_name,id,table_id="+this.model.tableId;
},
add () { add () {
this.edit(this.modelDefault); this.edit(this.modelDefault);
}, },

@ -12,6 +12,8 @@ import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils; import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.demo.functionx.entity.Functionx;
import org.jeecg.modules.demo.functionx.mapper.FunctionxMapper;
import org.jeecg.modules.demo.rulex.entity.Rulex; import org.jeecg.modules.demo.rulex.entity.Rulex;
import org.jeecg.modules.demo.rulex.service.IRulexService; import org.jeecg.modules.demo.rulex.service.IRulexService;
@ -49,8 +51,11 @@ import org.jeecg.common.aspect.annotation.AutoLog;
public class RulexController extends JeecgController<Rulex, IRulexService> { public class RulexController extends JeecgController<Rulex, IRulexService> {
@Autowired @Autowired
private IRulexService rulexService; private IRulexService rulexService;
@Autowired
/** FunctionxMapper functionxMapper;
/**
* 分页列表查询 * 分页列表查询
* *
* @param rulex * @param rulex
@ -66,12 +71,24 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) { HttpServletRequest req) {
QueryWrapper<Rulex> queryWrapper = QueryGenerator.initQueryWrapper(rulex, req.getParameterMap()); // QueryWrapper<Rulex> queryWrapper = QueryGenerator.initQueryWrapper(rulex, req.getParameterMap());
QueryWrapper<Rulex> queryWrapper=new QueryWrapper<>();
queryWrapper.eq("function_id",rulex.getFunctionId());
queryWrapper.orderByDesc("work_level");
if(rulex.getRuleCode()!=null){
queryWrapper.eq("rule_code",rulex.getRuleCode());
}
if(rulex.getTableId()!=null){
queryWrapper.eq("table_id",rulex.getTableId());
}
if(rulex.getFieldId()!=null){
queryWrapper.eq("field_id",rulex.getFieldId());
}
Page<Rulex> page = new Page<Rulex>(pageNo, pageSize); Page<Rulex> page = new Page<Rulex>(pageNo, pageSize);
IPage<Rulex> pageList = rulexService.page(page, queryWrapper); IPage<Rulex> pageList = rulexService.page(page, queryWrapper);
return Result.OK(pageList); return Result.OK(pageList);
} }
/** /**
* 添加 * 添加
* *
@ -82,10 +99,16 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
@ApiOperation(value="规则管理-添加", notes="规则管理-添加") @ApiOperation(value="规则管理-添加", notes="规则管理-添加")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<?> add(@RequestBody Rulex rulex) { public Result<?> add(@RequestBody Rulex rulex) {
if(rulex.getFunctionId()==null){
return Result.error("功能点错误!!!");
}
Functionx functionx = functionxMapper.selectById(rulex.getFunctionId());
rulex.setManagerUsers(functionx.getManagerUsers());
rulex.setWorkStatus(functionx.getWorkStatus());
rulexService.save(rulex); rulexService.save(rulex);
return Result.OK("添加成功!"); return Result.OK("添加成功!");
} }
/** /**
* 编辑 * 编辑
* *
@ -99,7 +122,7 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
rulexService.updateById(rulex); rulexService.updateById(rulex);
return Result.OK("编辑成功!"); return Result.OK("编辑成功!");
} }
/** /**
* 通过id删除 * 通过id删除
* *
@ -113,7 +136,7 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
rulexService.removeById(id); rulexService.removeById(id);
return Result.OK("删除成功!"); return Result.OK("删除成功!");
} }
/** /**
* 批量删除 * 批量删除
* *
@ -127,7 +150,7 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
this.rulexService.removeByIds(Arrays.asList(ids.split(","))); this.rulexService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!"); return Result.OK("批量删除成功!");
} }
/** /**
* 通过id查询 * 通过id查询
* *
@ -168,4 +191,9 @@ public class RulexController extends JeecgController<Rulex, IRulexService> {
return super.importExcel(request, response, Rulex.class); return super.importExcel(request, response, Rulex.class);
} }
} @GetMapping(value = "/sort")
public Result<?> sort(@RequestParam(name="id",required=true) String id) {
return rulexService.sort(id);
}
}

@ -3,6 +3,7 @@ package org.jeecg.modules.demo.rulex.mapper;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.demo.rulex.entity.Rulex; import org.jeecg.modules.demo.rulex.entity.Rulex;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@ -14,4 +15,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/ */
public interface RulexMapper extends BaseMapper<Rulex> { public interface RulexMapper extends BaseMapper<Rulex> {
@Select("select rule_no from rulex where function_id=#{id} order by rule_no desc limit 0,1")
String sort(String id);
@Select("select function_code from functionx where id=#{id}")
String find(String id);
} }

@ -1,5 +1,6 @@
package org.jeecg.modules.demo.rulex.service; package org.jeecg.modules.demo.rulex.service;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.demo.rulex.entity.Rulex; import org.jeecg.modules.demo.rulex.entity.Rulex;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
@ -11,4 +12,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/ */
public interface IRulexService extends IService<Rulex> { public interface IRulexService extends IService<Rulex> {
Result<?> sort(String id);
} }

@ -1,8 +1,10 @@
package org.jeecg.modules.demo.rulex.service.impl; package org.jeecg.modules.demo.rulex.service.impl;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.demo.rulex.entity.Rulex; import org.jeecg.modules.demo.rulex.entity.Rulex;
import org.jeecg.modules.demo.rulex.mapper.RulexMapper; import org.jeecg.modules.demo.rulex.mapper.RulexMapper;
import org.jeecg.modules.demo.rulex.service.IRulexService; import org.jeecg.modules.demo.rulex.service.IRulexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -16,4 +18,22 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service @Service
public class RulexServiceImpl extends ServiceImpl<RulexMapper, Rulex> implements IRulexService { public class RulexServiceImpl extends ServiceImpl<RulexMapper, Rulex> implements IRulexService {
@Autowired
RulexMapper rulexMapper;
@Override
public Result<?> sort(String id) {
String sort=rulexMapper.sort(id);
String functioncode=rulexMapper.find(id);
if(sort==null){
return Result.OK("001"+functioncode);
}else{
int i = Integer.parseInt(sort);
i++;
String s = Integer.toString(i);
while(s.length()<3){
s="0"+s;
}
return Result.OK(s+functioncode);
}
}
} }

Loading…
Cancel
Save