2022-12-14服装类型管理编码

zhc4dev
lenovo 2 years ago
parent 532fb72a9c
commit 5f7964261f
  1. 31
      ant-design-vue-jeecg/src/views/process/modules/ZyClothsTypeForm.vue
  2. 12
      jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/controller/ZyClothsTypeController.java
  3. 4
      jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/mapper/ZyClothsTypeMapper.java
  4. 2
      jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/service/IZyClothsTypeService.java
  5. 9
      jeecg-boot/jeecg-boot-module-process/src/main/java/org/jeecg/modules/demo/base/service/impl/ZyClothsTypeServiceImpl.java

@ -5,7 +5,12 @@
<a-row> <a-row>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="企业" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="enterpriseId"> <a-form-model-item label="企业" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="enterpriseId">
<j-select-depart v-model="model.enterpriseId" /> <j-select-depart v-model="model.enterpriseId" @change="bianhao" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="nums">
<a-input v-model="model.nums" placeholder="请输入编号" disabled ></a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
@ -18,11 +23,7 @@
{{ typeId }} {{ typeId }}
</a-form-item> </a-form-item>
</a-col> </a-col>
<!-- <a-col :span="24">-->
<!-- <a-form-model-item label="编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="nums">-->
<!-- <a-input v-model="model.nums" 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="typeName"> <a-form-model-item label="类型名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="typeName">
<a-input v-model="model.typeName" placeholder="请输入类型名称" ></a-input> <a-input v-model="model.typeName" placeholder="请输入类型名称" ></a-input>
@ -62,6 +63,7 @@
data () { data () {
return { return {
model:{ model:{
nums:''
}, },
typeId:"", typeId:"",
labelCol: { labelCol: {
@ -88,7 +90,8 @@
url: { url: {
add: "/base/zyClothsType/add", add: "/base/zyClothsType/add",
edit: "/base/zyClothsType/edit", edit: "/base/zyClothsType/edit",
queryById: "/base/zyClothsType/queryById" queryById: "/base/zyClothsType/queryById",
weiyi:"/base/zyClothsType/weiyi"
} }
} }
}, },
@ -102,6 +105,20 @@
this.modelDefault = JSON.parse(JSON.stringify(this.model)); this.modelDefault = JSON.parse(JSON.stringify(this.model));
}, },
methods: { methods: {
bianhao(){
var n=6
getAction(this.url.weiyi,null).then((res)=>{
var num=parseInt(res.result,10)+1
console.log(num)
num=num.toString()
while(num.length<n){
num="0"+num
}
console.log(num)
this.model.nums="QIYE"+num;
})
},
add () { add () {
this.edit(this.modelDefault); this.edit(this.modelDefault);
}, },

@ -96,7 +96,7 @@ public class ZyClothsTypeController extends JeecgController<ZyClothsType, IZyClo
zyClothsType.setTypeId(null); zyClothsType.setTypeId(null);
} }
//生成编号 nums,编号,varchar,10,非空,不重复,企业缩写(4)+顺序号(6)在service层处理 //生成编号 nums,编号,varchar,10,非空,不重复,企业缩写(4)+顺序号(6)在service层处理
zyClothsType.setNums(zyClothsTypeService.generateNumber()); // zyClothsType.setNums(zyClothsTypeService.generateNumber());
zyClothsTypeService.save(zyClothsType); zyClothsTypeService.save(zyClothsType);
return Result.OK("添加成功!"); return Result.OK("添加成功!");
} }
@ -183,4 +183,14 @@ public class ZyClothsTypeController extends JeecgController<ZyClothsType, IZyClo
return super.importExcel(request, response, ZyClothsType.class); return super.importExcel(request, response, ZyClothsType.class);
} }
@GetMapping(value = "/weiyi")
public Result<?> weiyi() {
String a=zyClothsTypeService.sort();
if(a==null){
return Result.OK("0");
}
return Result.OK(a.substring(4));
}
} }

@ -3,6 +3,7 @@ package org.jeecg.modules.demo.base.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.base.entity.ZyClothsType; import org.jeecg.modules.demo.base.entity.ZyClothsType;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@ -17,4 +18,7 @@ public interface ZyClothsTypeMapper extends BaseMapper<ZyClothsType> {
List<String> selectNumsList(); List<String> selectNumsList();
List<String> listByTypeId(String typeId); List<String> listByTypeId(String typeId);
@Select("select nums from zy_cloths_type where nums like 'QIYE%' order by nums desc limit 0,1 ")
String sort();
} }

@ -13,4 +13,6 @@ public interface IZyClothsTypeService extends IService<ZyClothsType> {
/**nums,编号,varchar,10,非空,不重复,企业缩写(4)+顺序号(6)*/ /**nums,编号,varchar,10,非空,不重复,企业缩写(4)+顺序号(6)*/
String generateNumber(); String generateNumber();
String sort();
} }

@ -40,6 +40,15 @@ public class ZyClothsTypeServiceImpl extends ServiceImpl<ZyClothsTypeMapper, ZyC
return nums + format; return nums + format;
} }
/*
* 顺序号
* */
@Override
public String sort() {
return zyClothsTypeMapper.sort();
}
private Long orderNumber() { private Long orderNumber() {
List<String> listString = zyClothsTypeMapper.selectNumsList(); List<String> listString = zyClothsTypeMapper.selectNumsList();
//System.out.println(listString); //System.out.println(listString);

Loading…
Cancel
Save