diff --git a/ant-design-vue-jeecg/src/views/customermeasure/admin/CustomerMeasureList.vue b/ant-design-vue-jeecg/src/views/customermeasure/admin/CustomerMeasureList.vue index 02be3562..8c987bb4 100644 --- a/ant-design-vue-jeecg/src/views/customermeasure/admin/CustomerMeasureList.vue +++ b/ant-design-vue-jeecg/src/views/customermeasure/admin/CustomerMeasureList.vue @@ -101,7 +101,7 @@ - + 排序 编辑 @@ -126,7 +126,7 @@ - + @@ -136,7 +136,7 @@ import { mixinDevice } from '@/utils/mixin' import { JeecgListMixin } from '@/mixins/JeecgListMixin' import CustomerMeasureModal from './modules/CustomerMeasureModal' -/* import CustomerMeasureModalpaixu from './modules/CustomerMeasureModalpaixu'*/ + import CustomerMeasureModal1 from './modules/CustomerMeasureModal1' import {filterMultiDictText} from '@/components/dict/JDictSelectUtil' import { getAction } from '@/api/manage' @@ -144,8 +144,8 @@ name: 'CustomerMeasureList', mixins:[JeecgListMixin, mixinDevice], components: { - CustomerMeasureModal/*, - CustomerMeasureModalpaixu*/ + CustomerMeasureModal, + CustomerMeasureModal1 }, data () { return { @@ -284,20 +284,20 @@ superFieldList:[], } }, - created(record){ + /* created(record){ getAction(this.url.moreYear,{ id: record.id}) - }, + },*/ computed: { importExcelUrl: function(){ return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; }, }, methods: { - /* paixu: function (record) { - this.$refs.modalFormpaixu.edit(record.id); + paixu: function (record) { + this.$refs.modalFormpaixu.edit(record.userId); this.$refs.modalFormpaixu.title = record.userId_dictText+"测体管理"; this.$refs.modalFormpaixu.disableSubmit = false; - },*/ + }, initDictConfig(){ }, getSuperFieldList(){ diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customermeasure/controller/CustomerMeasureController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customermeasure/controller/CustomerMeasureController.java index 619a9db9..b9683852 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customermeasure/controller/CustomerMeasureController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customermeasure/controller/CustomerMeasureController.java @@ -8,6 +8,7 @@ import java.util.stream.Collectors; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; +import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.jeecg.common.api.vo.Result; @@ -50,7 +51,7 @@ import org.jeecg.common.aspect.annotation.AutoLog; public class CustomerMeasureController extends JeecgController { @Autowired private ICustomerMeasureService customerMeasureService; - + /** * 分页列表查询 * @@ -72,7 +73,33 @@ public class CustomerMeasureController extends JeecgController pageList = customerMeasureService.page(page, queryWrapper); return Result.OK(pageList); } - + + + /** + * 分页列表查询 + * + * @param customerMeasure + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "顾客测体管理-分页列表查询") + @ApiOperation(value="顾客测体管理-分页列表查询", notes="顾客测体管理-分页列表查询") + @GetMapping(value = "/list1") + public Result queryPageList1(CustomerMeasure customerMeasure, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(customerMeasure, req.getParameterMap()); + System.out.println(req.toString()); + System.out.println(customerMeasure); + queryWrapper.eq("user_id",customerMeasure.getUserId()); + Page page = new Page(pageNo, pageSize); + IPage pageList = customerMeasureService.page(page, queryWrapper); + return Result.OK(pageList); + } + /** * 添加 * @@ -142,7 +169,7 @@ public class CustomerMeasureController extends JeecgController shang(@RequestParam(name="id",required=true) String id) { + customerMeasureService.up(id); + return Result.ok("升序成功"); + } + + + @AutoLog(value = "排序") + @ApiOperation(value="排序", notes="排序") + @GetMapping(value = "/down") + public Result xia(@RequestParam(name="id",required=true) String id) { + int a=customerMeasureService.findSort(id); + if(a==0){ + return Result.error("当前已经是最低级别!!!");}else { + customerMeasureService.down(id); + return Result.ok("降序成功"); + } + } + } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customermeasure/mapper/CustomerMeasureMapper.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customermeasure/mapper/CustomerMeasureMapper.java index 8ff16a67..72578fa7 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customermeasure/mapper/CustomerMeasureMapper.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customermeasure/mapper/CustomerMeasureMapper.java @@ -5,6 +5,8 @@ package org.jeecg.modules.demo.customermeasure.mapper; import java.util.List; import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; import org.jeecg.modules.demo.customermeasure.entity.CustomerMeasure; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.jeecg.modules.demo.customermeasure.entity.CustomerMeasure; @@ -17,4 +19,19 @@ import org.jeecg.modules.demo.customermeasure.entity.CustomerMeasure; */ public interface CustomerMeasureMapper extends BaseMapper { + @Select("select sort from customer_measure where id=#{id} ") + Integer upfindsort(String id); + + @Select("select id from customer_measure where sort=#{i} ") + String findproid(int i); + + @Update("update customer_measure set sort =#{i} where id = #{id} ") + void innew(String id, int i); + + @Update("update customer_measure set sort =#{sort} where id = #{proid} ") + void innewpro(String proid, Integer sort); + + + @Select("select sort from customer_measure where id=#{id} ") + int findSort(String id); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customermeasure/service/ICustomerMeasureService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customermeasure/service/ICustomerMeasureService.java index 8cd14d19..f2663e76 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customermeasure/service/ICustomerMeasureService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customermeasure/service/ICustomerMeasureService.java @@ -13,4 +13,9 @@ import org.jeecg.modules.demo.customermeasure.entity.CustomerMeasure; */ public interface ICustomerMeasureService extends IService { + void up(String id); + + int findSort(String id); + + void down(String id); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customermeasure/service/impl/CustomerMeasureServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customermeasure/service/impl/CustomerMeasureServiceImpl.java index dbebfabd..a5d6f903 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customermeasure/service/impl/CustomerMeasureServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customermeasure/service/impl/CustomerMeasureServiceImpl.java @@ -6,6 +6,7 @@ package org.jeecg.modules.demo.customermeasure.service.impl; import org.jeecg.modules.demo.customermeasure.entity.CustomerMeasure; import org.jeecg.modules.demo.customermeasure.mapper.CustomerMeasureMapper; import org.jeecg.modules.demo.customermeasure.service.ICustomerMeasureService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -19,4 +20,42 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @Service public class CustomerMeasureServiceImpl extends ServiceImpl implements ICustomerMeasureService { + + @Autowired + CustomerMeasureMapper customerMeasureMapper; + + @Override + public void up(String id) { + Integer sort = customerMeasureMapper.upfindsort(id); + if (sort>0) { + //升序前找到后一个排序 + String proid = customerMeasureMapper.findproid(sort + 1); + if (proid!="") { + //调换排序 + customerMeasureMapper.innew(id,sort+1); + customerMeasureMapper.innewpro(proid,sort); + } + } + + } + + @Override + public int findSort(String id) { + return customerMeasureMapper.findSort(id); + } + + @Override + public void down(String id) { + Integer sort = customerMeasureMapper.upfindsort(id); + if (sort>0) { + String proid = customerMeasureMapper.findproid(sort - 1); + if (proid!="") { + customerMeasureMapper.innew(id,sort-1); + customerMeasureMapper.innewpro(proid,sort); + } + } + + } + + }